Ssh keys

From Leaky
Revision as of 22:35, 10 November 2014 by Leaky (talk | contribs) (Generating an SSH key)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

On a Mac running OSX, you should be able to generate an SSH key with just a few commands, and then copy it onto any servers you login to regularly.

Check for existing SSH keys

$ ls -la ~/.ssh/

If there's anything in there such as id_rsa or id_dsa, you already have an SSH key and you should be careful not to overwrite them. The -f parameter for ssh-keygen will specify an alternative filename to write!

$ ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa_1

Once the key is generated (and be sure to protect it with a good passphrase), you can install it onto servers that you have password-based access to with this command.

$ ssh-copy-id user@servername

Obviously replace user with your username on that server, and servername with the actual server name (or IP address).