| Home » Categories » Multiple Categories |
How To Copy Files With Rsync Over SSH |
|
Article Number: 210 | Rating: Unrated | Last Updated: Tue, Sep 23, 2025 at 11:29 PM
|
Step 1 - Setup public SSH keysOn our origin server, we will generate public SSH keys with no password:ssh-keygen -f ~/.ssh/id_rsa -q -P "" cat ~/.ssh/id_rsa.pubThis is our public SSH key that can be placed on other hosts to give us access: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLVDBIpdpfePg/a6h8au1HTKPPrg8wuTrjdh0QFVPpTI4KHctf6/FGg1NOgM++hrDlbrDVStKn/b3Mu65//tuvY5SG9sR4vrINCSQF++a+YRTGU6Sn4ltKpyj3usHERvBndtFXoDxsYKRCtPfgm1BGTBpoSl2A7lrwnmVSg+u11FOa1xSZ393aaBFDSeX8GlJf1SojWYIAbE25Xe3z5L232vZ5acC2PJkvKctzvUttJCP91gbNe5FSwDolE44diYbNYqEtvq2Jt8x45YzgFSVKf6ffnPwnUDwhtvc2f317TKx9l2Eq4aWqXTOMiPFA5ZRM/CF0IJCqeXG6s+qVfRjB root@cloudadsCopy this key to your clipboard and login to your destination server. Place this SSH key into your ~/.ssh/authorized_keys file: If your SSH folder does not exist, create it manually: mkdir ~/.ssh chmod 0700 ~/.ssh touch ~/.ssh/authorized_keys chmod 0644 ~/.ssh/authorized_keys Step 3 - Rsync files overRsync is a great utility, as it allows you, among many other things, to copy files recursively with compression, and over an encrypted channel.We will copy a file from our origin server (198.211.117.101) in /root/bigfile.txt over to our destination server (IP: 198.211.117.129) and save it in /root/bigfile.txt as well. Login on 198.211.117.101 and rsync the file over to 198.211.117.129: rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress /root/bigfile.txt 198.211.117.129:/root/If you are using a different user, for example "username" then you would have to append it in front of destination server. Make sure to have your public key in that user's ~/.ssh/authorized_keys file: rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress /root/bigfile.txt [email protected]:/The SSH options are useful to keep Rsync quiet and not prompting everytime you connect to a new server. Verify that you have received the file on destination server (198.211.117.129): ls -la /root/bigfile.txtAnd you are all done! |
Attachments
There are no attachments for this article.
|
How To Create and Manage Databases in MySQL and MariaDB on a Cloud Server
Viewed 3280 times since Thu, Dec 26, 2013
How To Install and Use PostgreSQL on Ubuntu 12.04
Viewed 6722 times since Mon, Dec 30, 2013
How To Set Up Master Slave Replication in MySQL
Viewed 3826 times since Thu, Dec 26, 2013
How To Install And Run A Node.js App On Centos 6.4 64bit
Viewed 10912 times since Sun, Dec 29, 2013
How To Create, Remove, & Manage Tables in PostgreSQL on a Cloud Server
Viewed 3748 times since Mon, Dec 30, 2013
How To Create Nagios Plugins With Bash On Ubuntu 12.10
Viewed 2572 times since Sat, Jan 4, 2014
How To Set Up a Postfix Email Server with Dovecot: Dynamic Maildirs and LMTP
Viewed 4111 times since Mon, Dec 30, 2013
How To Create a New User and Grant Permissions in MySQL
Viewed 3724 times since Thu, Dec 26, 2013
How To Set Up Apache Virtual Hosts on Debian 7
Viewed 3765 times since Fri, Dec 27, 2013
How To Install Git on Debian 7
Viewed 3186 times since Fri, Dec 27, 2013
|
