Information Technology Reference
In-Depth Information
SSH protocol allows you to access your remote account with the ssh client using two
different methods of authorization. You can use the password to your account or pub-
lic/private keys.
The command discussed in Recipe 11-1:
$ ssh -p2222 vagrant@127.0.0.1
uses the first method. Access is granted if you provide a valid password to the account.
This method is straightforward but not convenient because git will ask for your pass-
word whenever you push or fetch.
The second method of authorization relies on RSA keys. There are two of them:
your private key is named
id_rsa
, and your public key is named
id_rsa.pub
. To
you have to:
eign@remote
account
son@local
to the file created in the previous step
The
authorized_keys
file is a very simple and effective way to allow access to
the SSH account. This file can contain an arbitrary number of public keys, each in sep-
arate lines.
The first step to master SSH authorization is to use the default
∼
/.ssh/id_rsa
and
∼
/.ssh/id_rsa.pub
files and
authorized_keys
on the remote host.
Sooner or later you will wonder why the keys have to be called
∼
/.ssh/id_rsa
and
∼
/.ssh/id_rsa.pub
. What if I want to use two or more pairs of keys? In that case
you will have to change the configuration of your ssh client.
Hint
You can treat the
∼
/.ssh/authorized_keys
file as the list of individuals
allowed to open the ssh session without giving a password.