My home machine is on a network behind a firewall and cannot be 'pinged' directly. I want to be able to run a cron job on a remote machine, which will log into my home machine and SECURELY copy the files.

These are the two obstacles to be overcome:

  1. How to make my machine (or at least the folder I wish to 'share') visible to the external world

  2. How to securely copy the files without human intervention.

Can anyone help?

BTW, both machines are running Ubuntu 10.0.4

  • 1
    You said can't be pinged but that does not imply you can't create a ftp server for example... with a ftp server you can make it and you can setup either with username and password or anonymous folder, with rsync rsync -avz -e ssh remoteuser@remotehost:/remote/dir /this/dir/ ... perhaps that is more information you need to share with us regarding your situation. – Prix Aug 7 '10 at 7:47
  • 1
    This belongs on SuperUser.com, given it is about home networking – warren Apr 4 '14 at 16:33

What you need to do :

  • make sure your home router forwards a port for ssh to your home computer. Standard for ssh is port 22, but you might want to pick another port to prevent random login attempts on this port.
  • make sure sshd (openssh server) runs on you home machine
  • Preferably make a ssh key on the sender machine and install that on you home machine, so your remote machine can login without a password exchange with you home machine.
  • make a simple cronjob using scp to copy files.
  • +1 for the really usefull tips. I am already using ssh to login to the remote machine from my home computer, so ssh is available on the local machine. What you suggest is definitely the way to go. However, there are 2 things not clear to me. 1. How to make sure my home router forwards a port to my home computer (I am using an OLD Draytek Vigor 2200 USB router). 2. How to make an SSH key on the sender machine and how to install that on my home machine. – user35402 Aug 7 '10 at 9:38
  • You might be able to tinker with these kind of firewall port settings by accessing the router's "control panel" by going to the appropriate URL from a machine in your home network. – Dougal Aug 7 '10 at 17:34
  • @morpheous You have to generate a pub key on you remote machine with ssh-keygen (linux) or putty (windows). The key, most of the time, called something like id_rsa.pub is then put in a file ~/.ssh/authorized_keys on your home machine, where ~ is the homedir of the user you want to login as. Make sure PubkeyAuthentication yes and AuthorizedKeysFile %h/.ssh/authorized_keys is in your /etc/ssh/sshd_config file on your home machine. You can now login automagically from the remote machine. By default you cannot login as root on Ubuntu (you know this probably). – Jasper Aug 7 '10 at 18:46
  • +1 for using private/public keys. Once you know how to use them, disable password logins by adding PasswordAuthentication no and ChallengeResponseAuthentication no to sshd_config. – Denilson Sá Maia Feb 15 '11 at 14:43
  • Also... Instead of using scp you might prefer to use rsync, as it has lots more features. – Denilson Sá Maia Feb 15 '11 at 14:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.