Setting Up OpenSSH to Authenticate Without Passwords on Slackware Linux

Synopsis:
Some functions of network monitoring programs require that a command be executed
remotely so the results can be returned and reported by the monitoring program. These
instructions show how to setup a SSH authenticated connection by generating RSA public
keys and get around the requirement to enter a password (actually, if you are getting the passwords
it's probably because the attempts at public authentication have failed).

Directions:

Start with the machine that needs to log into the remote machine (here labeled 'tiger').
1) Create new keys with the command ssh-keygen -t rsa

2) When queried by the program to save the file id_rsa press the Enter key to
accept the default value. Note: this part of the process creates a file for the private
key (id_rsa) and another for the public key id_rsa.pub). Files are saved in the directory
/home/[username]/.ssh for the username you are logged in under (for root this will be
/root/.ssh).


3) When asked for a passphrase press the Enter key to accept a blank passphrase.
Why? If you enter a passphrase here, you will be asked for it each time you try to
authenticate against the remote host.


4) Copy the public portion of the RSA key to the remote machine (labeled 'lion').
If you are logged in as root, copy with using a command like this:
scp id_rsa.pub root@remotehost.com:/root/.ssh/id_rsa_tiger.pub

(you can also ftp or email this over as an attachment).

5) Log into the remote machine lion and change to the directory /root/.ssh
(cd /root/.ssh)

6) Add the file you just copied over to the file authorized_keys2 by typing:
cat id_rsa_tiger.pub >> authorized_keys2

7) Return to the host machine (tiger) and test a remote command by typing:
ssh lion.remotehost.com w
If the authenticaton works, you should see the information
from the w command. If not, type ssh -v lion.remotehost.com w to view the authentication
process.




See Also:
http://www.openssh.org



Terra Firma Software Solutions, Inc.