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.

This is the dumbest thing because I have done this a load of times before and never had issue so I am sure I am just doing something daft but I can't for the life of me figure it out.

I am trying to connect from a Windows 7 machine to a Linux box using key based authentication.

Here are the steps I have followed;

  1. Ran ssh-keygen -t rsa from Git Bash.
  2. Selected the default area for the file to be stored.
  3. Did not pick a password (left it blank)
  4. Copied the contents of id_rsa.pub onto the remote server (/home/user/.ssh/authorized_keys)

When I try and log in using ssh user@ip.ip.ip.ip -v I can see that it tries to match up my keys from the correct location on the Windows box, but it does not accept them and ends up falling back to passwords as the authenitcation method.

I have checked the permissions of authorized_keys - it is set to rw for the owner only.

Any help would be greatly appreciated.

share|improve this question
1  
What about the permissions for the .ssh folder? it should be 700. Also, I've always use pageant for automagic authentication on PuTTY. –  gparent Mar 28 '12 at 14:39
    
Gah the .ssh folder! Thank you so much, I hadn't even thought about it. This worked. Please add this as an answer and I will accept. –  Toby Mar 28 '12 at 14:41
    
Answer completed. –  gparent Mar 28 '12 at 14:42
add comment

1 Answer

up vote 3 down vote accepted

In addition to the permissions on authorized_keys, it is important to also set the permissions on the .ssh folder containing it:

gp@platinum:~/.ssh$ ls -la
total 24
drwx------ 2 gp gp 4096 Aug 17  2011 ./
[...]
-rw------- 1 gp gp 3703 Oct 25 10:52 authorized_keys
gp@platinum:~/.ssh$

As you can see, the permissions for ~/.ssh should be 700, and the ones for ~/.ssh/authorized_keys should be 600.

share|improve this answer
add comment

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.