SSH to Use Public Key Authentication
1. At the shell prompt of the client system
ssh-keygen –t rsa
or
ssh-keygen –t dsa
2. When prompted for the file in which the private key will be saved,
press enter to use the default filename of
~/.ssh/id_rsa
or
~/.ssh/id_dsa
The associated public key will be saved as
~/.ssh/id_rsa.pub
or
~/.ssh/id_dsa.pub
The next thing you need to do is to copy the public key you just
created to the SSH server.
scp ~/.ssh/key_name.pub user_name@address_of_SSH_server:filename
At this point, the contents of the key file you just copied need to be
appended to the end of the
~/.ssh/authorized_keys
file in the home directory of the user you will connect to the SSH server as.
If desired, you can use the
ssh-agent
command to eliminate the need to enter the passphrase every time you establish
an SSH connection.
1. At the shell prompt of your client system, enter
ssh-agent bash
2. At the shell prompt, enter
ssh-add ~/.ssh/id_rsa
or
ssh-add ~/.ssh/id_dsa
depending on which key file you have created.
3. When prompted, enter the key file’s passphrase. When you do, you
should be prompted that the identity has been added. An example
follows:
rtracy@ws1:~> ssh-agent bash
rtracy@ws1:~> ssh-add ~/.ssh/id_rsa
Enter passphrase for /home/rtracy/.ssh/id_rsa:
Identity added: /home/rtracy/.ssh/id_rsa (/home/rtracy/.ssh/id_rsa)
rtracy@ws1:~>
Once this is done, the ssh-agent process stores the passphrase in
memory. It then listens for SSH requests and automatically provides
the key passphrase for you when requested.
Encryption V
No comments:
Post a Comment