Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

i have a linux (ubuntu 12) server, and a windows desktop.

i am trying to connect via ssh and private key

the server has these files

rw------- root.root /root/.ssh
rw------- root.root /root/.ssh/authorized_keys

rw------- user2.user2 /home/user2/.ssh
rw------- user2.user2 /home/user2/.ssh/authorized_keys

(i.e. chmod 600 for both .ssh directory AND the auth-key file)

The contents of "authorized_keys" is a copy for both root and user2. Only ownership is different.

When trying to connect from the desktop:

ssh -i mykey root@myhost.org   -- works, meaning the key is OK.
ssh -i mykey user2@myhost.org   -- doesn't work, for the same "mykey" file!

(Priv key fail, but password login works anyway, so it's not about server not accepting this user at all)

What could possibly be different between the root and user2?

(I tried also plink, putty's version for "ssh'ing", with PPK file - same results, so it's not a bug in ssh :) i think. )

Edit:

The specific error with ssh:

The authenticity of host '[myhost.org]:22 ([1.7.1.2]:22)' can't be established

Plink: "Server refused our key"

(ip/port/host in this msg are fake)

share|improve this question
4  
As per stackoverflow.com/questions/6377009/… the .ssh directory needs to have 700 permissions. –  Martin Prikryl Apr 26 '13 at 15:40
    
Thank you, that was correct. it solved my problem, but I still wonder then why there's a difference between root and "user2", and how comes I never encountered the need for 700 in the past decade! –  Berry Tsakala Apr 26 '13 at 16:05
1  
I suppose that root has all permissions implicitly. –  Martin Prikryl Apr 26 '13 at 16:45
    
@MartinPrikryl: could please make your comment an answer, so that the question doesn't remain unanswered? –  Cristian Ciupitu Oct 22 '13 at 19:22
    
@CristianCiupitu Ok, Done. –  Martin Prikryl Oct 23 '13 at 7:39

1 Answer 1

up vote 4 down vote accepted

As per question ~/.ssh/authorized_keys not working properly the .ssh directory needs to have 700 permissions.

The reason, it works for root even without the permissions set properly, is that root has implicit permissions for everything.

share|improve this answer
    
It's always weird when you're connect as a non-root user and you see that there's files you can't write into ^^ –  Kwaio Oct 23 '13 at 8:36

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.