How do I copy files from one domain name to another using the shell?

This page is showing a generic answer.
To see a more detailed answer customized for you, type your domain name here:

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:

ssh-copy-id target-domain-name.com@target-domain-name.com

After doing this, you should be able to connect from the source domain name to the destination domain name without a password, using:

ssh target-domain-name.com@target-domain-name.com

Commands that use SSH as the underlying protocol, such as “rsync” and “scp”, should also work, such as:

rsync -av directory target-domain-name.com@target-domain-name.com:~/html/

scp file target-domain-name.com@target-domain-name.com:~/html/