0

I am trying to connect from userA1@hostA to host userB1@hostB using ssh.

I added the content of .ssh/id_rsa.pub file from userA1 to .ssh/authorized_keys file of userB1.

Set authorized_keys and .ssh folder permission of userB1 to 600 and 700.

Tried to login using ssh command. Got - Permission denied (publickey).

Ok, then I created a new user at hostB, lets call him userB2. Did the same things as userB1. And successfully login from userA1@hostA to userB2@hostB!

So, I am totally confused why ssh is failing with userB1.

Last part of verbose message for 2 different users are as follows:

For userB1: ssh userB1@hostB <- failed

debug1: Unspecified GSS failure.  Minor code may provide more information
Cannot determine realm for numeric host address

debug2: we did not send a packet, disable method
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/userA1/.ssh/identity
debug3: no such identity: /home/userA1/.ssh/identity
debug1: Offering public key: /home/userA1/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug3: Wrote 368 bytes for a total of 1645
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Trying private key: /home/userA1/.ssh/id_dsa
debug3: no such identity: /home/userA1/.ssh/id_dsa
debug1: Trying private key: /home/userA1/.ssh/id_ecdsa
debug3: no such identity: /home/userA1/.ssh/id_ecdsa
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

For userB2: ssh userB2@hostB <- pass

debug1: Unspecified GSS failure.  Minor code may provide more information
Cannot determine realm for numeric host address

debug2: we did not send a packet, disable method
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/userA1/.ssh/identity
debug3: no such identity: /home/userA1/.ssh/identity
debug1: Offering public key: /home/userA1/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug3: Wrote 368 bytes for a total of 1645
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug2: input_userauth_pk_ok: SHA1 ................
..........

In hostB /var/log/secure file, when login using userB2 it shows:

Feb  3 11:54:19 development sshd[3246]: Accepted publickey for userB2 from hostA port 58773 ssh2

for userB1, it shows:

Feb  3 11:56:34 development sshd[3349]: Connection closed by hostA

In sshd_config file at hostB, there is nothing specified about any of those users. Can any of you help me to figure out the reason?

Thanks.

0

Everything seem to be all right. One possible reason could be Selinux context bug as mentioned in this post. In that case you have to run this command in your hostB from userB1:

restorecon -R -v ~/.ssh

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.