rsync over SSH with Key
Assume you have a remote machine which allows SSH login with key generated in [1]. The user account is foo and the key is stored in the file ~/fookey. The IP of the remote machine is 1.2.3.4.
You want to copy the content of local ~/local_dir/ to remote ~/remote_dir of user foo via the following rsync command:
$ rsync -avz ~/local_dir/ foo@1.2.3.4:~/remote_dir/ -e 'ssh -i ~/fookey'
References:
[1] | [AWS] Create/Migrate Linux Users on Amazon EC2 |
[2] |
[3] |
[4] | rsync over ftp - Google search |