Skip to content

Instantly share code, notes, and snippets.

@2-718
Created November 23, 2010 18:56
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save 2-718/712288 to your computer and use it in GitHub Desktop.
Save 2-718/712288 to your computer and use it in GitHub Desktop.
Generating SSH keys (OSX)

Generate ssh public keypair

$ cd ~/.ssh
$ ssh-keygen -t rsa -C "EMAIL"
Filename: EMAIL
Passphrase: choose appropriate passphrase
$ ssh-add EMAIL

Enable ssh-agent

$ ssh-agent bash
$ ssh-add ~/.ssh/id_rsa
$ ssh username@remote

Change private ssh key passphrase

$ ssh-keygen -p
Enter file in which the key is (~/.ssh/id_rsa): test_key
Enter old passphrase: 
Key has comment 'test_key'
Enter new passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved with the new passphrase.

Show fingerprint of specified public key

$ ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub
2048 fd:52:c5:f0:6b:b5:37:38:d7:93:e8:58:ab:bf:72:52 /etc/ssh/ssh_host_rsa_key.pub
$ ssh-keygen -lf id_rsa.pub
2048 e1:0a:a4:27:66:a7:6f:c8:77:cb:8d:d7:bd:f3:8f:d7 id_rsa.pub (RSA)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment