From that page:
The private key is kept on the computer you log in from, while the public key is stored on the .ssh/authorized_keys file on all the computers you want to log in to.
When creating a keyfile using ssh-keygen
, you'll get files named id_rsa
and id_rsa.pub
. The first is your private key (possibly password-protected) and should be kept secret all times. You are the client.
The latter is your public key which can be given to the other side, the server. The server can allow multiple public keys. The key files are plaintext files, so you can open them with any text-editor. The public keyfile has just one line, this line should be added to the ~/.ssh/authorized_keys
file on the server.
The private and public keys below are generated using ssh-keygen -t rsa
. The previous command created the files ~/.ssh/id_rsa
and ~/.ssh/id_rsa.pub
.
A private key file ~/.ssh/id_rsa
looks like:
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,6D5AD2DF5464E16B4E92E81D095A5E7E
NbCawtGTPOfveFHvV93uw5/veo/fAmbZEcitpNlq/rPEy8ZLo7/0MltFDUupe6dI
...23 lines omitted...
eiau+K6IAbhp84/6ewXPVJ6JbfeS9vyOqkcPaZDlQ3rvbAxU9dfTptc/ZWxVoCDg
-----END RSA PRIVATE KEY-----
The corresponding public key ~/.ssh/id_rsa.pub
looks like:
ssh-rsa AAAAB3NzaC1yc2EA[some chars omitted]X3aKKB6lOyr0v user@host
The first word is either ssh-rsa
(for RSA keys) or ssh-dss
(for DSA keys). The second part (AAAAB3...r0v
) is the actual data. user@host
is just a comment, and could be replaced with anything, like sysadmin from home
.