Difference between revisions of "Ssh keys"
From Leaky
m (Added to Security category) |
|||
Line 1: | Line 1: | ||
+ | [[Category:Security]] | ||
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. The same commands should also work on any recent Linux distribution. | 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. The same commands should also work on any recent Linux distribution. | ||
Revision as of 07:04, 30 June 2016
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. The same commands should also work on any recent Linux distribution.
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).