1752809 Members
5925 Online
108789 Solutions
New Discussion юеВ

Password less SSH

 
MKR_1
Frequent Advisor

Password less SSH

I am setting up password less SSH between two servers(S1 & S2).I can establish a password less ssh between S1 and S2 but not the otherway around(S2 to S1) even though I followed same procedure to setup this between S1 and S2.Please advice.
7 REPLIES 7
Sunny123_1
Esteemed Contributor

Re: Password less SSH

Hi

You can generate the ssh key (through ssh-keygen -t dsa) and then export it to the other server.


Regards
Sunny
Ganesan R
Honored Contributor

Re: Password less SSH

Hi Manikandarajan,

It should work if you would have done correct steps as in S1 to S2 and keep the correct permissions. Most of the time permission would be the culprit. You must have this permission on both servers.

Users home directory should have 755 permission.
$HOME/.ssh directory should have 700 permission
$HOME/.ssh/authorized_keys file should have 600 permission
Best wishes,

Ganesh.
Ganesan R
Honored Contributor

Re: Password less SSH

Hi Again,

These are the steps you need to follow to exchange the keys.

1.Login to serverA as user1.

2.$ssh-keygen -t dsa
Press enter for all the questions.It will create the private/public keys
under $HOME/.ssh/
File names are id_rsa and id_rsa.pub

3.Now you need to copy the id_rsa.pub file content into ServerB $HOME/.ssh/authorized_keys file
ServerA#scp ~user1/.ssh/id_rsa.pub ServerB:/tmp

Login to ServerB server

ServerB#cat /tmp/id_rsa.pub >> ~user1/.ssh/authorized_keys

Make sure the following permissions on serverB.

Users home directory should have 755 permission
$HOME/.ssh directory should have 700 permission
$HOME/.ssh/authorized_keys file should have 600 permission


Do the same steps on both servers.
Best wishes,

Ganesh.
MKR_1
Frequent Advisor

Re: Password less SSH

I have done exactly the same steps and permissions are also correct.Any thing else to be checked.
Ganesan R
Honored Contributor

Re: Password less SSH

Hi,

Ok. Does password ssh working from S2 to S1?

If not,
Do you have any firewall between these servers which doesn't allow ssh port from S2 to S1?

Have you blocked ssh connections on S2 server from any network?

Could you provide this output from S2 ?

#ssh -vv username@S1
Best wishes,

Ganesh.
MKR_1
Frequent Advisor

Re: Password less SSH

I did everything from scratch.It works now.Hopefully permission issue.
Thanks
MKR_1
Frequent Advisor

Re: Password less SSH

Permission issue