I am looking for tips on how to troubleshoot a problem with connecting to a new server via SSH. I am trying to connect using private-key authentication, where SSH uses my local private key to authenticate, without prompting for a password, but running into problems with that.
When I run ssh root@newserver
, the connection succeeds immediately, without prompting me for a password. In contrast, when I run ssh user@newserver
, the private-key authentication attempt fails and it prompts me for a password. I'm stumped about why the latter fails. What should I try, to debug this?
Things I've already tried:
I've carefully checked
/root/.ssh/authorized_keys
and/home/user/.ssh/authorized_keys
. Both are identical, and both contain my public key.I've carefully checked the permissions on
/root/.ssh
and/home/user/.ssh
directories onnewserver
. Everything seems fine, and in any case, the permissions are the same for both.I've tried logging in from two different clients, and see the same behavior on both, so I don't think it is client-specific. I can log into other servers successfully from both of those clients.
I tried running
/usr/sbin/sshd -d -p 2323
on the new server and then connecting usingssh -p 2323 root@newserver
andssh -p 2323 user@newserver
. Here's the brain-twisting part: when I launchsshd
by hand from the command line, I'm able to log in (both toroot
anduser
) via private-key authentication, but when I try to use the system-standardsshd
, I can only log in toroot
but not touser
via private-key authentication.I've run
ssh -v
. I don't see any enlightening messages: withssh -v root@newserver
, I getdebug1: Offering DSA public key: /home/user/.ssh/id_dsa debug1: Server accepts key: pkalg ssh-dss blen 433
With
ssh -v user@newserver
, I getdebug1: Offering DSA public key: /home/daw/.ssh/id_dsa debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
Adding more
-v
's doesn't lend any insight; withssh -vvvvv bingen.cs.berkeley.edu
, I getdebug1: Offering DSA public key: /home/daw/.ssh/id_dsa debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
so no indication of why the attempt to log in via private-key authentication failed.
This is Fedora 21, openssh-6.6.1p1-11.1.fc21.x86_64.
~/.ssh
as well as that folder itself have to follow certain rules (ownership/permissions), ifStrictModes yes
is set insshd_config
. To diagnose issues in general follow my guide here.grep -v '^[[:space:]]*$' /etc/ssh/sshd_config |grep -v '^#'
in an edit, so we can see what may be missing/wrong in thesshd_config
file?