Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have created an ssh key pair using ssh-keygen -t rsa for my main user and everything seems to be working well. Password login has been disabled.

I have a second user that I am trying to create a pair for, and I am having trouble logging in. I did the process identically to the first user, but when I log on Putty gives me the following error --> server refused our key

There is an error box that pops up as well saying Disconnected: No supported authentication methods available(server sent publickey, gssapi-keyex,gssapi-with-mic)

I have tried re-doing the process with ssh-keygen -t rsa and performing the process differently with Puttygen, although it is always the same error.

Any advice? I am on a CentOS virtual private server

logs from non-working user:

[deploy@server .ssh]$ sudo /usr/sbin/sshd -d
debug1: sshd version OpenSSH_5.3p1
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: private host key: #1 type 2 DSA
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-d'
Set /proc/self/oom_score_adj from 0 to -1000
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
debug1: Bind to port 22 on ::.
Server listening on :: port 22.
debug1: Server will not fork when running in debugging mode.
debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
debug1: inetd sockets after dupping: 3, 3
Connection from 85.105.187.20 port 4040
debug1: Client protocol version 2.0; client software version PuTTY-Local: Mar 19                                2005 07:19:17
debug1: no match: PuTTY-Local: Mar 19 2005 07:19:17
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: permanently_set_uid: 74/74
debug1: list_hostkey_types: ssh-rsa,ssh-dss
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: client->server aes256-cbc hmac-sha1 none
debug1: kex: server->client aes256-cbc hmac-sha1 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST_OLD received
debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: KEX done
debug1: userauth-request for user root service ssh-connection method none
debug1: attempt 0 failures 0
reverse mapping checking getaddrinfo for 85.105.187.20.static.ttnet.com.tr [85.1                               05.187.20] failed - POSSIBLE BREAK-IN ATTEMPT!
debug1: PAM: initializing for "root"
debug1: PAM: setting PAM_RHOST to "85.105.187.20"
debug1: PAM: setting PAM_TTY to "ssh"
Received disconnect from 85.105.187.20: 11: No supported authentication methods                                available
debug1: do_cleanup
debug1: do_cleanup
debug1: PAM: cleanup

Logs from working user:

[arguably@server .ssh]$ sudo /usr/sbin/sshd -d
debug1: sshd version OpenSSH_5.3p1
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: private host key: #1 type 2 DSA
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-d'
Set /proc/self/oom_score_adj from 0 to -1000
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
debug1: Bind to port 22 on ::.
Server listening on :: port 22.
debug1: Server will not fork when running in debugging mode.
debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
debug1: inetd sockets after dupping: 3, 3
Connection from 192.185.0.164 port 15567
debug1: Client protocol version 2.0; client software version zabbix_agent
debug1: no match: zabbix_agent
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: permanently_set_uid: 74/74
debug1: list_hostkey_types: ssh-rsa,ssh-dss
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 192.185.0.164
debug1: do_cleanup
debug1: do_cleanup
share|improve this question

put on hold as unclear what you're asking by Braiam, jasonwryan, jimmij, Ramesh, Anthon 2 days ago

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

    
You need to look at the server side logs. They will tell you why sshd is rejecting the login attempts. –  Patrick May 11 at 2:36
    
Did you create the keypair as the second user? If not, put the users's public key into /home/second_user/.ssh/authorized_keys –  Creek May 11 at 2:49
    
@Creek I did create the keypairs as the second user. I put the public key in exactly where you mention –  Brian Leach May 11 at 2:52
1  
@BrianLeach something is fishy with your logs. Yes, the first log says it's trying to log in as root. The second log doesn't show any login at all. –  Patrick May 11 at 18:22
1  
Please post the content of /etc/sshd_config (or /etc/ssh/sshd_config, wherever your distribution puts it). Also, for the second user, the output of ls -ld ~bob ~bob/.ssh ~bob/.ssh/authorized_keys (with the user name instead of bob). –  Gilles May 11 at 21:50

1 Answer 1

Your sshd isn't configured to allow public key logins, hence ssh-connection method none. In your /etc/ssh/sshd_config uncomment or add the following then restart sshd

PubkeyAuthentication yes

Additionally, the logs from the working user don't actually show anyone logging in with a public key. Also, from what's shown in the good logs, you'll need to figure out why you're logging in as root instead of the second user.

share|improve this answer

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