Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to connect to my linux server using the following:

ssh-keygen -t rsa

I then do:

cat ~/.ssh/id_rsa.pub | ssh myusername@myserver_ip 'cat >> .ssh/authorized_keys'

I then go to my remote server and see that a "authorized_keys" file has been created. However when i try doing, "ssh myusername@myserver_ip", it is still prompting me for a password?

Why???

share|improve this question
    
Try with ssh -vvv myusername@myserver_ip to see more details. –  Janne Pikkarainen May 30 '12 at 7:46
    
You can check /var/log/auth.log or /var/log/secure on the server side. You can check your sshd configuration : RSAAuthentication yes, PubkeyAuthentication yes. –  Christophe Drevet May 30 '12 at 10:01

3 Answers 3

Verify the ownership and permissions on your ~/.ssh directory and its contents:

$ sudo chown -R <user> ~/.ssh
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/*
share|improve this answer
    
didn't work...... –  jini May 30 '12 at 4:32
1  
Well you're going to need to post more details then. –  EEAA May 30 '12 at 4:34
    
Did you do this on the server side ? –  Christophe Drevet May 30 '12 at 10:00

You may need to check the sshd_config to ensure that these are enabled:

RSAAuthentication yes
PubkeyAuthentication yes

Once those are set to 'yes' then you will need to restart ssh.

share|improve this answer

Ok First of all make sure you have this options enabled in your /etc/ssh/sshd_config

    RSAAuthentication yes
    PubKeyAuthentication yes
    AuthorizedKeysFlle %h/.ssh/authorized_keys

Second, in order to copy the key from ServerA(where you generated the key) to ServerB(where you want to log in) use the following command:

    ssh-copy-id your_username@your_serverB_Ip

If by any chance ServerA doesnt have ssh-copy-id command, in ServerA copy the first line of your key WITHOUT the last 2 characters, then paste it in the ServerB Authorized_Keys file. After that type yourself the missing characters from the line you just copied and the first one from line 2, this will prevent adding a "new line" between the first and second line of the key while pasting it from ServerA to ServerB. Repeat with the 3rd line

share|improve this answer

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.