Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Here is the situation: I have 4 Linux servers. /home is same for all the four servers. (It's a network drive). I want to setup a password-less SSH via setting up encryption keys. I created RSA key pair using ssh-keygen. Because the /home is same for all users. So I added the public key to authorized key for $HOME/.ssh directory

But when I try to ssh to these servers, it still asks for the password.

Help please!

share|improve this question
    
Did you set your permissions right on the files in the .ssh directory. The easiest is to delete them on remote and then use ssh-copy-id. –  don.joey Oct 15 '13 at 12:30
    
I moved key pair to home directory, now I have oct15, oct15.pub in $HOME. then "ssh-copy-id -i $HOME/oct15.pub user@machine2". It shows it did something n asks me to check "ssh user@machine2". It still doesnot work. It asks for password –  ravidixit Oct 15 '13 at 12:53
    
Please note /home is same for user on all servers. –  ravidixit Oct 15 '13 at 12:58
    
can you please run ssh -v to one of the servers, then add the output to your question? –  roadmr Oct 15 '13 at 14:25
    
Please confirm that the password request comes from the remote. That is, it reads user@remote's password:, not Enter password for private key:. Also please add the output of ls -al ~/.ssh to your question. –  zwets Oct 15 '13 at 19:00

1 Answer 1

When you enter ssh hostname SSH tries password-based auth by default. So you have to enter an additional option to the command:

ssh -i .ssh/private-key-of-host hostname

After the -i option should be the filename of your key. Now you can login without entering a password.

However there another possibility: You can have a configuration file in .ssh/config. Enter here:

Host Foo
  HostName 123.45.67.89
  IdentityFile ~/.ssh/private-key-of-host

Now you can enter ssh Foo and SSH tries to connect to the host mentioned in HostName (can be a IP address or a hostname) with the key from IdentityFile.

share|improve this answer
    
There is no need to pass -i when you use one of the default keyfiles (identity, id_rsa, etc.). Ssh will try PKI-based authentication in preference to password authentication. –  zwets Oct 15 '13 at 18:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.