Skip to content

Instantly share code, notes, and snippets.

@KavenTheriault
Last active June 26, 2018 15:34
Show Gist options
  • Save KavenTheriault/f525b462ea001b63d22631280615df1a to your computer and use it in GitHub Desktop.
Save KavenTheriault/f525b462ea001b63d22631280615df1a to your computer and use it in GitHub Desktop.
SSH login without password using SSH keys

SSH login without password using SSH keys

Using ssh-copy-id command

ssh-copy-id -i ~/.ssh/my_key_rsa user@server_address

Manually

Enabling AuthorizedKeys

Uncomment the following line from the sshd config file located at /etc/ssh/sshd_config

AuthorizedKeysFile      %h/.ssh/authorized_keys

Then restart the ssh deamon

$ sudo systemctl restart sshd

Authorizing the SSH Key

Create the authorized_keys file in the .ssh folder of the home folder of the user you want to connect with.

$ touch ~/.ssh/authorized_keys
$ chmod 600 ~/.ssh/authorized_keys

Add the content of your id_rsa.pub file in the authorized_keys file on the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment