
Arcom Embedded Linux Technical Manual Secure Shell (SSH)
Public key authentication methods
In addition to regular password authentication, SSH also offers public key
authentication. Public key authentication works by generating a public/private key pair.
The public part may be passed around freely in order to transfer it to a remote system
running SSH. The private part must remain a secret, since anyone possessing the
private key can login to any system configured with the public key.
A private key designated for interactive use normally has a pass-phrase that adds an
extra layer of security. However, a private key designated for non-interactive use (such
as in a script on a remote system), does not.
The ssh-agent command enables you to only enter your pass-phrase once per
session. See Further information about SSH
, page 28.
Generating keys
Public/private key pairs are generated using the ssh-keygen utility:
$ ssh-keygen -t dsa
Generating public/private dsa key pair.
[...]
This utility asks for a destination (press Enter to accept the default) and a pass-phrase
(which may be left blank). If you accepted the default location, you have a DSA
public/private key pair in ~/.ssh/id_dsa.pub and ~/.ssh/id_dsa.
SSH can also use RSA keys by passing rsa rather than dsa to ssh-keygen. RS
keys are stored in id_rsa and id_rsa.pub.
The file id_dsa is your private key and you must keep this safe. Your public key is in
id_dsa.pub. You can copy this to a remote machine and append it to the file
~/.ssh/authorized_keys to enable public key authentication on that host.
Once you have configured the remote host, you can continue to use all the SSH utilities
as normal. The authorized_keys file can also be used to restrict the commands that
may be run when that key is used. This means you can restrict the commands that can
be run by an interactive script (where the key has an empty pass-phrase). See Further
information about SSH
, page 28.
© 2006 Arcom Issue G 27
Kommentare zu diesen Handbüchern