Ssh password-less logon authentication failed

Source: Internet
Author: User
Tags hmac

Symptom:

The serverA machine has produced the rsa key.

The public key has been added to the server B server/root/. ssh/authorized_keys

But the ssh root@135.251.208.141 machine still requires a password, that is, password-free authentication fails

Analysis and Processing:

Use ssh-v debug for access. The log is as follows, but the cause of failure cannot be seen from the log. Only when publickey is used for authentication, no reply is provided to the peer;

At this time, Baidu mentioned that you can view/var/log/secure logs.

Check serverB machine/var/log/secure and the following error is reported:

Jan 8 13:31:34 wng-141 sshd [32366]: Authentication refused: bad ownership or modes for directory/root
Jan 8 13:31:34 wng-141 sshd [32367]: Connection closed by 135.251.218.231

? In this log, the permission for the/root directory may be incorrect. Then Baidu searches for "Authentication refused: bad ownership or modes for directory/root"

It is found that the HOME directory of all users should have 700 permissions. Otherwise, many problems may occur. This problem is also caused by this problem.

Finally, run chmod 700 root to solve the problem.

[Root @ wng-231 ~] #/Usr/bin/ssh-vvv-I/opt/aware/Central/. sshkey/id_rsa-oConnectTimeout = 1-o StrictHostKeyChecking = no-o PasswordAuthentication = no root@135.251.208.141
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
Debug1: Reading configuration data/etc/ssh/ssh_config
Debug1: Applying options *
Debug2: ssh_connect: needpriv 0
Debug1: Connecting to 135.251.208.141 [135.251.208.141] port 22.
Debug2: fd 3 setting O_NONBLOCK
Debug1: fd 3 clearing O_NONBLOCK
Debug1: Connection established.
Debug3: timeout: 1000 MS remain after connect
Debug1: permanently_set_uid: 0/0
Debug3: Not a RSA1 key file/opt/aware/Central/. sshkey/id_rsa.
Debug2: key_type_from_name: unknown key type '----- begin'
Debug3: key_read: missing keytype
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug3: key_read: missing whitespace
Debug2: key_type_from_name: unknown key type '----- end'
Debug3: key_read: missing keytype
Debug1: identity file/opt/aware/Central/. sshkey/id_rsa type 1
Debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
Debug1: match: OpenSSH_5.3 pat OpenSSH *
Debug1: Enabling compatibility mode for protocol 2.0
Debug1: Local version string SSH-2.0-OpenSSH_5.3
Debug2: fd 3 setting O_NONBLOCK
Debug1: SSH2_MSG_KEXINIT sent
Debug3: Wrote 792 bytes for a total of 813
Debug1: SSH2_MSG_KEXINIT initialized ed
Debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256, diffie-hellman-group-exchange-sha1, diffie-hellman-group14-sha1, diffie-hellman-group1-sha1
Debug2: kex_parse_kexinit: ssh-rsa, ssh-dss
Debug2: kex_parse_kexinit: aes128-ctr, aes192-ctr, aes256-ctr, arcfour256, arcfour128, aes128-cbc, 3des-cbc, blowfish-cbc, cast128-cbc, aes192-cbc, aes256-cbc, arcfour, rijndael-cbc@lysator.liu.se
Debug2: kex_parse_kexinit: aes128-ctr, aes192-ctr, aes256-ctr, arcfour256, arcfour128, aes128-cbc, 3des-cbc, blowfish-cbc, cast128-cbc, aes192-cbc, aes256-cbc, arcfour, rijndael-cbc@lysator.liu.se
Debug2: kex_parse_kexinit: hmac-md5, hmac-sha1, umac-64@openssh.com, hmac-ripemd160, hmac-ripemd160@openssh.com, hmac-sha1-96
Debug2: kex_parse_kexinit: hmac-md5, hmac-sha1, umac-64@openssh.com, hmac-ripemd160, hmac-ripemd160@openssh.com, hmac-sha1-96
Debug2: kex_parse_kexinit: none, zlib@openssh.com, zlib
Debug2: kex_parse_kexinit: none, zlib@openssh.com, zlib
Debug2: kex_parse_kexinit:
Debug2: kex_parse_kexinit:
Debug2: kex_parse_kexinit: first_kex_follows 0
Debug2: kex_parse_kexinit: reserved 0
Debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256, diffie-hellman-group-exchange-sha1, diffie-hellman-group14-sha1, diffie-hellman-group1-sha1
Debug2: kex_parse_kexinit: ssh-rsa, ssh-dss
Debug2: kex_parse_kexinit: aes128-ctr, aes192-ctr, aes256-ctr, arcfour256, arcfour128, aes128-cbc, 3des-cbc, blowfish-cbc, cast128-cbc, aes192-cbc, aes256-cbc, arcfour, rijndael-cbc@lysator.liu.se
Debug2: kex_parse_kexinit: aes128-ctr, aes192-ctr, aes256-ctr, arcfour256, arcfour128, aes128-cbc, 3des-cbc, blowfish-cbc, cast128-cbc, aes192-cbc, aes256-cbc, arcfour, rijndael-cbc@lysator.liu.se
Debug2: kex_parse_kexinit: hmac-md5, hmac-sha1, umac-64@openssh.com, hmac-ripemd160, hmac-ripemd160@openssh.com, hmac-sha1-96
Debug2: kex_parse_kexinit: hmac-md5, hmac-sha1, umac-64@openssh.com, hmac-ripemd160, hmac-ripemd160@openssh.com, hmac-sha1-96
Debug2: kex_parse_kexinit: none, zlib@openssh.com
Debug2: kex_parse_kexinit: none, zlib@openssh.com
Debug2: kex_parse_kexinit:
Debug2: kex_parse_kexinit:
Debug2: kex_parse_kexinit: first_kex_follows 0
Debug2: kex_parse_kexinit: reserved 0
Debug2: mac_setup: found hmac-md5
Debug1: kex: server-> client aes128-ctr hmac-md5 none
Debug2: mac_setup: found hmac-md5
Debug1: kex: client-> server aes128-ctr hmac-md5 none
Debug1: SSH2_MSG_KEX_DH_GEX_REQUEST (1024 <1024) sent
Debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
Debug3: Wrote 24 bytes for a total of 837
Debug2: dh_gen_key: priv key bits set: 120/256
Debug2: bits set: 537/1024
Debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
Debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
Debug3: Wrote 144 bytes for a total of 981
Debug3: check_host_in_hostfile: filename/root/. ssh/known_hosts
Debug3: check_host_in_hostfile: match line 7
Debug1: Host '2017. 251.208.141 'is known and matches the RSA host key.
Debug1: Found key in/root/. ssh/known_hosts: 7
Debug2: bits set: 505/1024
Debug1: ssh_rsa_verify: signature correct
Debug2: kex_derive_keys
Debug2: set_newkeys: mode 1
Debug1: SSH2_MSG_NEWKEYS sent
Debug1: expecting SSH2_MSG_NEWKEYS
Debug3: Wrote 16 bytes for a total of 997
Debug2: set_newkeys: mode 0
Debug1: SSH2_MSG_NEWKEYS received ed
Debug1: SSH2_MSG_SERVICE_REQUEST sent
Debug3: Wrote 48 bytes for a total of 1045
Debug2: service_accept: ssh-userauth
Debug1: SSH2_MSG_SERVICE_ACCEPT received ed
Debug2: key:/opt/aware/Central/. sshkey/id_rsa (0x7f09ff288620)
Debug3: Wrote 64 bytes for a total of 1109
Debug1: Authentications that can continue: publickey, gssapi-keyex, gssapi-with-mic, password
Debug3: start over, passed a different list publickey, gssapi-keyex, gssapi-with-mic, password
Debug3: preferred gssapi-keyex, gssapi-with-mic, publickey, keyboard-interactive
Debug3: authmethod_lookup gssapi-keyex
Debug3: remaining preferred: gssapi-with-mic, publickey, keyboard-interactive
Debug3: authmethod_is_enabled gssapi-keyex
Debug1: Next authentication method: gssapi-keyex
Debug1: No valid Key exchange context
Debug2: we did not send a packet, disable method
Debug3: authmethod_lookup gssapi-with-mic
Debug3: remaining preferred: publickey, keyboard-interactive
Debug3: authmethod_is_enabled gssapi-with-mic
Debug1: Next authentication method: gssapi-with-mic
Debug3: Trying to reverse map address 135.251.208.141.
Debug1: An invalid name was supplied
Cannot determine realm for numeric host address
Debug1: An invalid name was supplied
Cannot determine realm for numeric host address
Debug1: An invalid name was supplied
Debug1: An invalid name was supplied
Debug2: we did not send a packet, disable method
Debug3: authmethod_lookup publickey
Debug3: remaining preferred: keyboard-interactive
Debug3: authmethod_is_enabled publickey
Debug1: Next authentication method: publickey
Debug1: Offering public key:/opt/aware/Central/. sshkey/id_rsa
Debug3: send_pubkey_test
Debug2: we sent a publickey packet, wait for reply
Debug3: Wrote 368 bytes for a total of 1477
Debug1: Authentications that can continue: publickey, gssapi-keyex, gssapi-with-mic, password
Debug2: we did not send a packet, disable method
Debug1: No more authentication methods to try.
Permission denied (publickey, gssapi-keyex, gssapi-with-mic, password ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.