Skip to content

Instantly share code, notes, and snippets.

@pierdom
Last active September 7, 2017 07:55
Show Gist options
  • Save pierdom/67b68e0f6b161147a7341d620ad1888f to your computer and use it in GitHub Desktop.
Save pierdom/67b68e0f6b161147a7341d620ad1888f to your computer and use it in GitHub Desktop.
[Set up public key authentication (no password) for SSH] #linux #mac #sysadmin #networking

On client, generate public and private keys pair:

localusr@client:~$ ssh-keygen -t rsa

Copy public key on the server (create the remote ~/.ssh directory if it does not exists):

localusr@client:~$ cat .ssh/id_rsa.pub | ssh remoteusr@server 'cat >> .ssh/authorized_keys'

Now we can connect to the remote server without password:

localusr@client:~$ ssh remoteusr@server
remoteusr@server:~$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment