Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have successfully created a key based auth for root user from my A machine to my B machine.

Now, I created a new user on B machine, the same as on A machine, let's call him USER. I created a home dir for him on B machine /home/USER and I want to create key based auth for him from machine A to B machine.

So, I ran on A machine

  1. ssh-keygen -t rsa, accepted all paths, so /home/USER/.ssh/id_rsa and with no phrases
  2. ssh-copy-id -i /home/USER/.ssh/ USER@BmachinesIP, entered password and got massage

Now try logging into the machine bla bla bla

So everything seems to be OK.

But when I tried to connect ssh USER@BmachinesIP I was asked for a password. I tried to see the log and ran ssh -vvv USER@BmachinesIP and here is a part of output:

debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/USER/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/USER/.ssh/id_dsa
debug3: no such identity: /home/USER/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
USER@BmachinesIP's password:

So, can anyone tell me what I've done wrong or what I should change? Maybe the issue is in the permissions, here they are:

on A machine:

drwx------  2 USER USER    SIZE DATE TIME .ssh
-rw-------  1 USER USER 1675 2011-10-31 14:36 id_rsa
-rw-r--r--  1 USER USER 413 2011-10-31 14:36

and on B machine:

drwx------  2 USER defaultGroup    SIZE DATE TIME .ssh
-rw-------    1 USER defaultGroup    SIZE DATE TIME authorized_keys
share|improve this question

migrated from Oct 31 '11 at 10:06

This question came from our site for professional and enthusiast programmers.

I have found a solution. There was an issue in permissions.

/home/USER on remote machine was granted all permissions, but for key based auth it must be set to 755

share|improve this answer
Wow. Amazing that there is zero debug output about permissions even though they are central to proper public key config. – jchook Feb 18 '13 at 16:47
Wow, you are right. Now it's working.... though I really want to keep the permission it had originally (775). Any clue about how to change that? – pablox Apr 7 '13 at 22:54
Seems that there's no way, only workaround would be set the StrictModes no in sshd_config. :/. – pablox Apr 7 '13 at 23:02
Essentially you need these permissions: chmod o-w ~/; chmod 700 ~/.ssh; chmod 600 ~/.ssh/authorized_keys, then it works. Copied from the answer of Maxime R. from here: – erik Jul 30 '13 at 21:27
I've done all these permissions changes, and it still asks me for a password when I ssh. I've also verified that the private key is the same on both machines (Ubuntu). Pretty puzzled. – Amalgovinus Jun 17 '14 at 2:05

Your Answer


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.