Skip to content

Nicholas Duffy

rsync While Specifying an SSH key

rsync, ssh, shell1 min read

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.

1rsync -azP -e "ssh -i ~/.ssh/my_other_key" --delete local_dir/ [email protected]:/remote_dir/