pipefail.dev


I write about Python, Go, Node.js,
cloud infrastructure, and data.
Share: 

rsync While Specifying an SSH key

If you need to rsync to a server and specify a different SSH than your default you certainly can, though it’s not initially intuitive. If you read the man page, however, and see the -e flag, then it starts to make sense. This flag says that it’s used to “specify the remote shell to use”. With that, we can create an rsync command to use a different SSH key.

rsync -azP -e "ssh -i ~/.ssh/my_other_key" --delete local_dir/ my_remote_user@12.34.56.789:/remote_dir/
, , ,