How do I copy files from one domain name to another using the shell?
If you have multiple domain names hosted with us, we assign each domain name a different Unix user ID to prevent cross-site contamination.
However, occasionally customers who use the command-line shell need to copy files between those domain names using rsync or other SSH tools.
While you can simply type the password on the shell command line, you can also use SSH keys to avoid that.
To do this, create a key on the “source” domain name you’ll be connecting from by typing ssh-keygen -t rsa and saving it without a password, like this:
$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/ex/example.com/.ssh/id_rsa): Created directory '/home/ex/example.com/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/ex/example.com/.ssh/id_rsa. Your public key has been saved in /home/ex/example.com/.ssh/id_rsa.pub.
Then copy the contents of the new “id_rsa.pub” key to the “destination” server. An easy and safe method is to use the “ssh-copy-id” command:
After doing this, you should be able to connect from the source domain name to the destination domain name without a password, using:
Commands that use SSH as the underlying protocol, such as “rsync” and “scp”, should also work, such as:
rsync -av directory email@example.com:~/html/ scp file firstname.lastname@example.org:~/html/