0

I am trying to configure my Ubuntu 16.04 server so I can public key ssh to it as root. I have many Ubuntu 14.04 servers configured this way and they work fine. On my Ubuntu 16.04 server it asks me for a password even though I am passing a public key.

Here is how my sshd_config file is set up;

PermitRootLogin prohibit-password

StrictModes yes

RSAAuthentication yes

PubkeyAuthentication yes

IgnoreRhosts yes

RhostsRSAAuthentication no

HostbasedAuthentication no

PermitEmptyPasswords no

ChallengeResponseAuthentication no

Here is the output of ssh -vvv when I try to ssh;

debug3: authmethod_is_enabled publickey

debug1: Next authentication method: publickey

debug1: Offering RSA public key: /root/.ssh/id_rsa

debug3: send_pubkey_test

debug3: send packet: type 50

debug2: we sent a publickey packet, wait for reply

debug3: receive packet: type 51

debug1: Authentications that can continue: publickey,password

debug1: Trying private key: /root/.ssh/id_dsa

debug3: no such identity: /root/.ssh/id_dsa: No such file or directory

debug1: Trying private key: /root/.ssh/id_ecdsa

debug3: no such identity: /root/.ssh/id_ecdsa: No such file or directory

debug1: Trying private key: /root/.ssh/id_ed25519

debug3: no such identity: /root/.ssh/id_ed25519: No such file or directory

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

Why is it Trying all private keys except /root/.ssh/id_rsa which is what i am using?

Also, non-root users are able to public key ssh without any problem so this must be something specific to the root user.

Any help will be greatly appreciated! Thanks in advance!

Here are my file permissions;

Server:

drwx------ 2 root root 4096 Aug 19 07:48 ../.ssh

drwx------ 2 root root 4096 Aug 19 07:48 .

drwx------ 4 root root 4096 Aug 19 08:19 ..

-rw------- 1 root root 400 Aug 19 07:48 authorized_keys

-rw------- 1 root root 888 Aug 18 10:58 known_hosts

Client:

drwx------ 2 root root 4096 Aug 19 07:47 ../.ssh

drwx------ 2 root root 4096 Aug 19 07:47 .

drwx------ 3 root root 4096 Aug 19 07:54 ..

-rw------- 1 root root 1675 Aug 19 07:47 id_rsa

-rw-r--r-- 1 root root 400 Aug 19 07:47 id_rsa.pub

-rw------- 1 root root 444 Aug 18 09:56 known_hosts

1 Answer 1

0

I finally figured out what was causing my issue. Because the sshd_config file on the server has the entry ServerKeyBits 1024 I had to create the key at 1024 bits, ssh-keygen -t rsa -b 1024.

Thanks anyway for your consideration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.