LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   SSH public keys not working - RH 7.3 (https://www.linuxquestions.org/questions/linux-newbie-8/ssh-public-keys-not-working-rh-7-3-a-378982/)

menator 11-01-2005 12:10 PM

SSH public keys not working - RH 7.3
 
Ok I know this is a common problem but I've checked the basics and I still cannot get it to work...

I am trying to set up ssh over two servers using public keys instead of using passwords.
I did the following:

ssh-keygen -t rsa

and it creates the files in the usal dir .ssh/id.rsa and .ssh/id_rsa.pub

I then copy the .pub file to the server i wish to connect to:
scp .ssh/id_rsa.pub <server>:.ssh/authorized_keys2


I then checked the permissions on the files/dirs so that we have:

server1:
drwx------ .ssh
|
-rw------- id_rsa
-rw-r--r-- id_rsa.pub

server2:
drwx------ .ssh
|
-rw-r--r-- authorized_keys2


This is correct is it not?

Whenever i try to ssh to server2 from server1 i get a password prompt. Is there anything else that could be causing the problem? Maybe something specific to RH7.3?

Tinkster 11-01-2005 12:35 PM

Re: SSH public keys not working - RH 7.3
 
Hi, and welcome to LQ!

Quote:

Originally posted by menator
server2:
drwx------ .ssh
|
-rw-r--r-- authorized_keys2
Where did that two come from?



Cheers,
Tink

Mikhail_16 11-01-2005 02:06 PM

It all depends on how your /etc/ssh/sshd_config is setup.

Please check that you do have 'pubkey authentication' enabled and that the file is named correctly as above poster mentions.

menator 11-02-2005 05:11 AM

I checked the config file and the 'pubkey authentication' line is commented out meaning it must be using the default, which is 'yes'.

The reason for the '2' is that it was stated in my O'Reilly book, perhaps that was a typo. I tried removing the 2 and it made no difference.

menator 11-02-2005 09:18 AM

Could it have anything to so with user accounts? I will not be using this logged on as root but as another user.
I cant seem to find anything else that could be causing the problem.

menator 11-02-2005 10:03 AM

On further thought it may still be a permissions issue, this time with the home directory. At the moment my home dir is full access 777. Perhaps thats why ssh doesnt like it when I try to use pulic keys.
I'll check it out.

Tinkster 11-02-2005 12:26 PM

No, 777 on the home wouldn't affect that (but it's a bad
idea).

Another common problem for authorized_keys is the way
they get transferred from one machine to the other. Check
that the file on the server does have the public key in
ONE line.


Cheers,
Tink

menator 11-03-2005 04:55 AM

Just checked and it is all on one line.


All times are GMT -5. The time now is 08:11 PM.