SSH
Revision as of 22:13, 9 January 2011 by Chris Tyler (talk | contribs) (→Using SSH with Public-Key Authentication)
SSH is the Secure Shell tool, a powerful encrypted communication tool.
Contents
Using SSH with Public-Key Authentication
Although SSH can be used with passwords, a sysadmin may need to initiate hundreds of SSH connections a day, and typing passwords that often is tedious. SSH therefore permits authentication using public and private keys.
Background: Public Key Cryptography
See Public Key Cryptography for an overview of how this technology works.
Using Public Keys with SSH
Creating a Public/Private Key Pair
- Enter this command:
ssh-keygen
- Answer the questions asked by ssh-keygen. Use default values for most questions. The use of a passphrase is recommended.
- ssh-keygen will produce two files:
-
~/.ssh/id_rsa
- your private key -
~/.ssh/id_rsa.pub
- your public key
-
Sending the Public Key to a Remote System Administrator
- Mail (or otherwise send) the
~/.ssh/id_rsa.pub
file to the remote system administrator.
Setting up Public Key Authentication on Two Machines
Manually:
- Copy the public key to the remote system you wish to access.
- Create the
~/.ssh
directory if it does not exist.- Set the permission on
~/.ssh
to 0700
- Set the permission on
- Append the public key to the file
~/authorized_keys
- Set the permission on
~/authorized_keys
to 0600
- Set the permission on
Automatically:
- Run the command:
ssh-copy-id user@host