Help on passwordless ssh...

Hi,

Can someone help me on ssh-keygen usage...?

I used ssh-keygen after which "id.pub" file was generated in system1's > .ssh directory...

I copied the same into the remote system system2 > .ssh directory as "authorized_keys" file.

Now i tried ssh connection from system 1 to system 2..... but it is still asking for password on system 2....

Can anybody help me on this please ???

Why didnt you use ssh-keygen -t dsa?
would have produced something like:

Generating public/private dsa key pair.
Enter file in which to save the key (/home/vbe/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/vbe/.ssh/id_dsa.
Your public key has been saved in /home/vbe/.ssh/id_dsa.pub.
...

which works for me...

Hi vbe,

I have used the same command ssh-keygen -t dsa
It did ask me for a file name and .pub file was also generated.
Then I created a duplicate copy of the .pub file as authorized_keys and ftp to the remote machine.
Now it should not ask me for password when I try to ssh to the remote machine.....but it is asking for the password........

How do I achieve passwordless login.....is the above procedure correct ??

The mistake was to use ftp...
We assume sshd is running on both boxes, and so you should have transfered the file using scp, doing so you would have known if sshd is up on the remote server since it would have asked you the password...
Once transefred you could have tested again and it should have worked...
So start by checking if sshd is up on both servers then maybe check for incompatibilities (version differ too much?...)

Thank you very much for the correction.....

There is a small correction in my reply above.....

The .pub file that was generated, I copied it into the remote system by means of ftp.
Then I logged off from ftp...and on system 1 i tried connecting to system2 by ssh.....

ftp was used only for copying authorized_keys file to remote machine.....
I tried using scp to copy the file but i am getting permission denied error inspite of changing all the file and directory permissions on both the systems to rw-r--r-- and rwzrw-rw- respectively....

Please suggest on the same...

Thanks in advance...

ant:/home/vbe $ cat 4ux.com.txt 
i
dr-xr-xr-x   2 tftp       other           96 Mar 13  2003 tftpdir
drwxrwxr-x  18 vbe        bin           3072 Jan  6 12:35 vbe
ant:/home $ chmod 755 vbe
ant:/home $ sh^H ^Hsh tp72f
The authenticity of host 'tp72f (1.2.3.4)' can't be established.
RSA key fingerprint is 65:00:f7:e5:33:6a:40:6c:00:14:92:2b:b3:82:20:83.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'tp72f,1.2.3.4' (RSA) to the list of known hosts.

|-----------------------------------------------------------------|
| This system is for the use of authorized users only.            |
| Individuals using this computer system without authority, or in |
| excess of their authority, are subject to having all of their   |
| activities on this system monitored and recorded by system      |
| personnel.                                                      |
|                                                                 |
| In the course of monitoring individuals improperly using this   |
| system, or in the course of system maintenance, the activities  |
| of authorized users may also be monitored.                      |
|                                                                 |
| Anyone using this system expressly consents to such monitoring  |
| and is advised that if such monitoring reveals possible         |
| evidence of criminal activity, system personnel may provide the |
| evidence of such monitoring to law enforcement officials.       |
|-----------------------------------------------------------------|

vbe@tp72f's password:
Last login: Thu Jan  6 13:09:39 2005 from 6.7.8.9

|-----------------------------------------------------------------|
| This system is for the use of authorized users only.            |
| Individuals using this computer system without authority, or in |
| excess of their authority, are subject to having all of their   |
| activities on this system monitored and recorded by system      |
| personnel.                                                      |
|                                                                 |
| In the course of monitoring individuals improperly using this   |
| system, or in the course of system maintenance, the activities  |
| of authorized users may also be monitored.                      |
|                                                                 |
| Anyone using this system expressly consents to such monitoring  |
| and is advised that if such monitoring reveals possible         |
| evidence of criminal activity, system personnel may provide the |
| evidence of such monitoring to law enforcement officials.       |
|-----------------------------------------------------------------|

$ pwd
/export/home/vbe
$ exit
Connection to tp72f closed.
ant:/home/vbe $ scp authorized_keys tp72f:/export/home/vbe/.ssh/.
ant:/home $ cd .ssh                                          
ant:/home/vbe/.ssh $ scp authorized_keys tp72f:/export/home/vbe/.ssh/.

ant:/home/vbe/.ssh $ cd
ant:/home/vbe $ ssh tp72f                                  
ant:/home/vbe $

|-----------------------------------------------------------------|
| This system is for the use of authorized users only.            |
| Individuals using this computer system without authority, or in |
| excess of their authority, are subject to having all of their   |
| activities on this system monitored and recorded by system      |
| personnel.                                                      |
|                                                                 |
| In the course of monitoring individuals improperly using this   |
| system, or in the course of system maintenance, the activities  |
| of authorized users may also be monitored.                      |
|                                                                 |
| Anyone using this system expressly consents to such monitoring  |
| and is advised that if such monitoring reveals possible         |
| evidence of criminal activity, system personnel may provide the |
| evidence of such monitoring to law enforcement officials.       |
|-----------------------------------------------------------------|

Last login: Thu Jan  6 13:11:40 2005 from 6.7.8.9

|-----------------------------------------------------------------|
| This system is for the use of authorized users only.            |
| Individuals using this computer system without authority, or in |
| excess of their authority, are subject to having all of their   |
| activities on this system monitored and recorded by system      |
| personnel.                                                      |
|                                                                 |
| In the course of monitoring individuals improperly using this   |
| system, or in the course of system maintenance, the activities  |
| of authorized users may also be monitored.                      |
|                                                                 |
| Anyone using this system expressly consents to such monitoring  |
| and is advised that if such monitoring reveals possible         |
| evidence of criminal activity, system personnel may provide the |
| evidence of such monitoring to law enforcement officials.       |
|-----------------------------------------------------------------|

$ pwd
/export/home/vbe

$ exit
Connection to tp72f closed.
ant:/home/vbe $ exit

Thank you for the information....

the user is not a root......

and the authorized_keys file is copied into /home/.ssh directory on remote system2.

I changed it to /home/newusr/.ssh/authorized_keys......

It worked fine.....I am able to ssh to remote system passwordless...

Thank you very much for the correction and valuable suggestions...

My pleasure...