On the Source server.
ssh-keygen -b 4096cat ~/.ssh/id_rsa.pub
On the Destination server, paste the content of ~/.ssh/id_rsa.pub
into ~/.ssh/authorized_keys
.
nano ~/.ssh/authorized_keys
If ~/.ssh/
doesn't exist, create the directory.
mkdir ~/.sshchmod 0700 ~/.sshnano ~/.ssh/authorized_keyschmod 0644 ~/.ssh/authorized_keys
On the Source server.
rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress /SOURCE USER@IP_ADDRESS:/DEST
NOTE: If SOURCE is a directory, exclude the directory name is DEST
Specify identity file without depending on ~/.ssh/id_rsa
rsync -avz -e "ssh -i IDENTITY_KEY.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress /SOURCE USER@IP_ADDRESS:/DEST
Exclude files for rsync
rsync -avz -e "ssh -i IDENTITY_KEY.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress /SOURCE USER@IP_ADDRESS:/DEST --exclude "*.pyc" --exclude "__pycache__" --exclude ".git" --exclude ".gitignore"