This is a great way to perform automatic backups to a remote host over SSH. It requires shell access on both servers (obviously). Note that this is not the most secure way to do this, it is the easiest though.
- Login to the server that you wish to connect from, as the user you wish to connect as. We’ll call this Server1.
- cd into ~/.ssh (you may need to create this directory).
your RSA keys (we do not want to set a passphrase here, or we will be
prompted for it everytime we try to use it, which would defeat the
- ssh-keygen -t rsa
- scp ~/.ssh/id_rsa.pub remoteuser@server2:~/.ssh/server1_id_rsa.pub
- cat server1_id_rsa.pub >> authorized_keys
authorized keys file (this will not work if the permissions are
- rm server1_id_rsa.pub && chmod 600 authorized_keys