ssh-keygen
[top]
ssh-keygen
> ssh-keygen -t dsa
Creates dsa encrypted keys.
Creates ~/.ssh/id_dsa (private key).
Creates ~/.ssh/id_dsa.pub (public key).
> ssh-keygen -t rsa
Creates rsa encrypted keys.
Creates ~/.ssh/id_rsa (private key).
Creates ~/.ssh/id_rsa.pub (public key).
[top]
~/.ssh dir structure
~/.ssh
authorized keys: list of public keys which will be granted access and require no login password
id_dsa: private dsa encypted key
id_dsa.pub: public dsa encrypted key
id_rsa: private rsa encrypted key
id_rsa.pub: public rsa encyrpted key
known_hosts: list of known host keys the current user has previously secure shelled to
Typical secure shell home directory file contents.
[top]
authorized_keys
Put your public key in this file on the remote server so it will no longer prompt for password.
CAVEAT: make sure the entire key is all on one line!
The best way to do this is to copy id_[dsa/rsa].pub to the remote server and then type:
> cat id_dsa.pub >> $HOME/.ssh/authorized_keys
[top]
known_hosts
This file stores host keys you have ssh'd to. It checks this each time you login and if the keys
don't match it warns of possible unscrupulous activity. If this occurs and you know the server you are connecting to has
been re-installed or re-configured, go ahead and remove the server entry in here. It will be re-populated during the next connection.
[top]
TIP!
You can actually organize your keys in various sub directories and then specify which set to use when using ssh.
Example:
~/.ssh/
site1/
id_dsa
id_dsa.pub
id_rsa
id_rsa.pub
site2/
id_dsa
id_dsa.pub
id_rsa
id_rsa.pub
> ssh -i ~/.ssh/site1 user@site1.com
> ssh -i ~/.ssh/site2 user@site2.com
Cheatsheets






