So I keep forgetting how to do this, and thought it’d be good to have a self-note on this.
- If you haven’t done so, create RSA key pairs using the following command. (hint: just keep pressing Enter and follow the instructions.)
You should now have
~/.ssh/id_rsa.pub, which are your private and public keys, respectively.
Ensure that the remote computer that you want to passwordlessly SSH into has an
.sshfolder in the home directory.
Copy your public key (not your private key) to the remote machine, using the following command (replace
usernamewith your username and
hostnamewith the host name or IP of the remote computer).
- Some versions of SSH do not like it if the
.sshdirectory are not given the correct permissions. So SSH into your remote computer, and perform the following commands. If you’re wondering what these commands do, they grant read, write, execute permissions in the
.sshdirectory, and read, write permissions to
- You should be able to SSH into the remote computer without typing your password!