How to setup SSH password-less login on Red Hat Enterprise Linux 4 and below

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 3
  • Red Hat Enterprise Linux 4
  • openssh

Issue

  • How to setup SSH password-less login on Red Hat Enterprise Linux 4 and below

Resolution

To enable key-based authentication perform the following steps:

1. On the ssh client, generate a new ssh key using the ssh-keygen command. It will ask for a path to save the file, and a passphrase, just press "enter" to select all default values ( specifically for a blank pasphrase) and to return to console.

[user@ssh-client ~]$ ssh-keygen -t dsa

2. Copy your id_dsa.pub file to the server running sshd service using scp or a suitable method. Following example uses scp command:

[user@ssh-client ~]$ scp ~/.ssh/id_dsa.pub user@ssh-server:~/id_dsa.pub

3. On the ssh server side, to allow ssh client to connect to the server running sshd service, add the content of the id_dsa.pub file from another system using the following format:

[user@ssh-server ~]$ cat id_dsa.pub >> ~/.ssh/authorized_keys 

4. After setting up the authorized_keys file, run the following command to setup the permission correctly on the sshd server.

[user@ssh-server ~]$ chmod 0700 ~/.ssh -R 

Now whenever the ssh command is used between those two system, it will not ask for the password.

Comment

  • For security reasons, it is preferred that a passphrase be used for creating ssh authentication key.
  • For Red Hat Enterprise Linux 5 and above, refer to How do I setup SSH passwordless login?
SBR
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.