SSH не проходит аутентификацию по ключу (странным способом)

Обсуждение настройки и работы сервисов, резервирования, сетевых настроек и вопросов безопасности ОС.

Модераторы: SLEDopit, Модераторы разделов

sptica
Сообщения: 126
ОС: Ubuntu

SSH не проходит аутентификацию по ключу

Сообщение sptica »

При включенной аутентификации по ключам если положить в другое место публичный ключ:

Код: Выделить всё

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile /home/jft/ssh/authorized_keys


то в лог начинается писаться странное:

Код: Выделить всё

sshd[27070]: Authentication refused: bad ownership or modes for directory /

Т.е. ругается он на /. А права, с которыми обычно в этом месте возникают сложности в порядке:

Код: Выделить всё

# ls -la /home/jft
drwxr-x--- 19 jf   jf     4096 февр.  5 17:40 .
drwx------  2 jf   jf     4096 февр.  5 17:27 ssh

При этом, если путь к ключам вернуть на более-менее дефолтный (для пользователя jf):

Код: Выделить всё

AuthorizedKeysFile /home/%u/ssh/authorized_keys

или

Код: Выделить всё

AuthorizedKeysFile /home/jf/ssh/authorized_keys

то спокойно заходит аутнтифицируясь по ключу. Захожу из под пользователя jf.

Пробовал включать дебаг и на клиенте и на сервере. Вот что пишет сервер:

Код: Выделить всё

Feb  5 18:09:55 server2 sshd[26717]: debug3: fd 5 is not O_NONBLOCK
Feb  5 18:09:55 server2 sshd[26717]: debug1: Forked child 27455.
Feb  5 18:09:55 server2 sshd[26717]: debug3: send_rexec_state: entering fd = 8 config len 744
Feb  5 18:09:55 server2 sshd[26717]: debug3: ssh_msg_send: type 0
Feb  5 18:09:55 server2 sshd[26717]: debug3: send_rexec_state: done
Feb  5 18:09:55 server2 sshd[27455]: debug3: oom_adjust_restore
Feb  5 18:09:55 server2 sshd[27455]: Set /proc/self/oom_score_adj to 0
Feb  5 18:09:55 server2 sshd[27455]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
Feb  5 18:09:55 server2 sshd[27455]: debug1: inetd sockets after dupping: 3, 3
Feb  5 18:09:55 server2 sshd[27455]: Connection from 192.168.0.37 port 46991
Feb  5 18:09:55 server2 sshd[27455]: debug1: Client protocol version 2.0; client software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4
Feb  5 18:09:55 server2 sshd[27455]: debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4 pat OpenSSH*
Feb  5 18:09:55 server2 sshd[27455]: debug1: Enabling compatibility mode for protocol 2.0
Feb  5 18:09:55 server2 sshd[27455]: debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.8
Feb  5 18:09:55 server2 sshd[27455]: debug2: fd 3 setting O_NONBLOCK
Feb  5 18:09:55 server2 sshd[27455]: debug2: Network child is on pid 27456
Feb  5 18:09:55 server2 sshd[27455]: debug3: preauth child monitor started
Feb  5 18:09:55 server2 sshd[27455]: debug3: privsep user:group 107:0 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: permanently_set_uid: 107/0 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: list_hostkey_types: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: SSH2_MSG_KEXINIT sent [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: SSH2_MSG_KEXINIT received [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: 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 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: 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 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: none,zlib@openssh.com [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: none,zlib@openssh.com [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit:  [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit:  [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: first_kex_follows 0  [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: reserved 0  [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-ed25519,ssh-rsa,ssh-dss [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit:  [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit:  [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: first_kex_follows 0  [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_parse_kexinit: reserved 0  [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: mac_setup: found hmac-md5 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: kex: client->server aes128-ctr hmac-md5 none [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: mac_setup: found hmac-md5 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: kex: server->client aes128-ctr hmac-md5 none [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_key_sign entering [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_send entering: type 5 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_key_sign: waiting for MONITOR_ANS_SIGN [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_receive_expect entering: type 6 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_receive entering [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_receive entering
Feb  5 18:09:55 server2 sshd[27455]: debug3: monitor_read: checking request 5
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_answer_sign
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_answer_sign: signature 0x7f1b469d17b0(99)
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_send entering: type 6
Feb  5 18:09:55 server2 sshd[27455]: debug2: monitor_read: 5 used once, disabling now
Feb  5 18:09:55 server2 sshd[27455]: debug2: kex_derive_keys [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: set_newkeys: mode 1 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: SSH2_MSG_NEWKEYS sent [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: expecting SSH2_MSG_NEWKEYS [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: set_newkeys: mode 0 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: SSH2_MSG_NEWKEYS received [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: KEX done [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: userauth-request for user jf service ssh-connection method none [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: attempt 0 failures 0 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_getpwnamallow entering [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_send entering: type 7 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_getpwnamallow: waiting for MONITOR_ANS_PWNAM [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_receive_expect entering: type 8 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_receive entering [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_receive entering
Feb  5 18:09:55 server2 sshd[27455]: debug3: monitor_read: checking request 7
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_answer_pwnamallow
Feb  5 18:09:55 server2 sshd[27455]: debug2: parse_server_config: config reprocess config len 744
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_answer_pwnamallow: sending MONITOR_ANS_PWNAM: 1
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_send entering: type 8
Feb  5 18:09:55 server2 sshd[27455]: debug2: monitor_read: 7 used once, disabling now
Feb  5 18:09:55 server2 sshd[27455]: debug2: input_userauth_request: setting up authctxt for jf [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_start_pam entering [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_send entering: type 50 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_inform_authserv entering [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_send entering: type 3 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: input_userauth_request: try method none [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_receive entering
Feb  5 18:09:55 server2 sshd[27455]: debug3: monitor_read: checking request 50
Feb  5 18:09:55 server2 sshd[27455]: debug1: PAM: initializing for "jf"
Feb  5 18:09:55 server2 sshd[27455]: debug1: PAM: setting PAM_RHOST to "192.168.0.37"
Feb  5 18:09:55 server2 sshd[27455]: debug1: PAM: setting PAM_TTY to "ssh"
Feb  5 18:09:55 server2 sshd[27455]: debug2: monitor_read: 50 used once, disabling now
Feb  5 18:09:55 server2 sshd[27455]: debug1: userauth-request for user jf service ssh-connection method publickey [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: attempt 1 failures 0 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug2: input_userauth_requestOpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to server2 [192.168.0.130] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/jf/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /home/jf/.ssh/id_rsa type 1
debug1: identity file /home/jf/.ssh/id_rsa-cert type -1
debug1: identity file /home/jf/.ssh/id_dsa type -1
debug1: identity file /home/jf/.ssh/id_dsa-cert type -1
debug1: identity file /home/jf/.ssh/id_ecdsa type -1
debug1: identity file /home/jf/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/jf/.ssh/id_ed25519 type -1
debug1: identity file /home/jf/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.8
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.8 pat OpenSSH_5* compat 0x0c000000
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "server2" from file "/home/jf/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/jf/.ssh/known_hosts:122
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-ed25519,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,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-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-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: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,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,ecdsa-sha2-nistp256
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-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-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: setup hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: setup hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 14:a7:bd:1c:22:ce:f1:8b:3d:31:6f:12:d6:d6:e6:f3
debug3: load_hostkeys: loading entries for host "server2" from file "/home/jf/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/jf/.ssh/known_hosts:122
debug3: load_hostkeys: loaded 1 keys
debug3: load_hostkeys: loading entries for host "192.168.0.130" from file "/home/jf/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/jf/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys
debug1: Host 'server2' is known and matches the ECDSA host key.
debug1: Found key in /home/jf/.ssh/known_hosts:122
debug1: ssh_ecdsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/jf/.ssh/id_rsa (0x7ff652d37a90),
debug2: key: /home/jf/.ssh/id_dsa ((nil)),
debug2: key: /home/jf/.ssh/id_ecdsa ((nil)),
debug2: key: /home/jf/.ssh/id_ed25519 ((nil)),
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/jf/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/jf/.ssh/id_dsa
debug3: no such identity: /home/jf/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/jf/.ssh/id_ecdsa
debug3: no such identity: /home/jf/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/jf/.ssh/id_ed25519
debug3: no such identity: /home/jf/.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
: try method publickey [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug1: test whether pkalg/pkblob are acceptable [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_key_allowed entering [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_send entering: type 21 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_key_allowed: waiting for MONITOR_ANS_KEYALLOWED [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_receive_expect entering: type 22 [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_receive entering [preauth]
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_receive entering
Feb  5 18:09:55 server2 sshd[27455]: debug3: monitor_read: checking request 3
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_answer_authserv: service=ssh-connection, style=, role=
Feb  5 18:09:55 server2 sshd[27455]: debug2: monitor_read: 3 used once, disabling now
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_receive entering
Feb  5 18:09:55 server2 sshd[27455]: debug3: monitor_read: checking request 21
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_answer_keyallowed entering
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_answer_keyallowed: key_from_blob: 0x7f1b469fbe20
Feb  5 18:09:55 server2 sshd[27455]: debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
Feb  5 18:09:55 server2 sshd[27455]: debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
Feb  5 18:09:55 server2 sshd[27455]: debug1: temporarily_use_uid: 10026/10026 (e=0/0)
Feb  5 18:09:55 server2 sshd[27455]: debug1: trying public key file /home/jft/ssh/authorized_keys
Feb  5 18:09:55 server2 sshd[27455]: debug1: fd 8 clearing O_NONBLOCK
[b]Feb  5 18:09:55 server2 sshd[27455]: Authentication refused: bad ownership or modes for directory /[/b]
Feb  5 18:09:55 server2 sshd[27455]: debug1: restore_uid: 0/0
Feb  5 18:09:55 server2 sshd[27455]: Failed publickey for jf from 192.168.0.37 port 46991 ssh2
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_answer_keyallowed: key 0x7f1b469fbe20 is not allowed
Feb  5 18:09:55 server2 sshd[27455]: debug3: mm_request_send entering: type 22
Feb  5 18:09:55 server2 sshd[27455]: debug2: userauth_pubkey: authenticated 0 pkalg ssh-rsa [preauth]


А вот это клиент:

Код: Выделить всё

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to server2 [192.168.0.130] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/jf/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /home/jf/.ssh/id_rsa type 1
debug1: identity file /home/jf/.ssh/id_rsa-cert type -1
debug1: identity file /home/jf/.ssh/id_dsa type -1
debug1: identity file /home/jf/.ssh/id_dsa-cert type -1
debug1: identity file /home/jf/.ssh/id_ecdsa type -1
debug1: identity file /home/jf/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/jf/.ssh/id_ed25519 type -1
debug1: identity file /home/jf/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.8
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.8 pat OpenSSH_5* compat 0x0c000000
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "server2" from file "/home/jf/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/jf/.ssh/known_hosts:122
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-ed25519,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,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-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-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: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,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,ecdsa-sha2-nistp256
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-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-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: setup hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: setup hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 14:a7:bd:1c:22:ce:f1:8b:3d:31:6f:12:d6:d6:e6:f3
debug3: load_hostkeys: loading entries for host "server2" from file "/home/jf/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/jf/.ssh/known_hosts:122
debug3: load_hostkeys: loaded 1 keys
debug3: load_hostkeys: loading entries for host "192.168.0.130" from file "/home/jf/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/jf/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys
debug1: Host 'server2' is known and matches the ECDSA host key.
debug1: Found key in /home/jf/.ssh/known_hosts:122
debug1: ssh_ecdsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/jf/.ssh/id_rsa (0x7ff652d37a90),
debug2: key: /home/jf/.ssh/id_dsa ((nil)),
debug2: key: /home/jf/.ssh/id_ecdsa ((nil)),
debug2: key: /home/jf/.ssh/id_ed25519 ((nil)),
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/jf/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/jf/.ssh/id_dsa
debug3: no such identity: /home/jf/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/jf/.ssh/id_ecdsa
debug3: no such identity: /home/jf/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/jf/.ssh/id_ed25519
debug3: no such identity: /home/jf/.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


/etc/sshd_config:

Код: Выделить всё

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel DEBUG3

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile    /etc/ssh/%u/authorized_keys
AuthorizedKeysFile /home/jft/ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
UseDNS no


Буду благодарен за любую помощь.
Спасибо сказали:
Аватара пользователя
serzh-z
Бывший модератор
Сообщения: 8259
Статус: Маньяк
ОС: Arch, Fedora, Ubuntu

Re: SSH не проходит аутентификацию по ключу

Сообщение serzh-z »

А что в `ls -la /`?
Спасибо сказали:
Аватара пользователя
Bizdelnick
Модератор
Сообщения: 21494
Статус: nulla salus bello
ОС: Debian GNU/Linux

Re: SSH не проходит аутентификацию по ключу

Сообщение Bizdelnick »

sptica писал(а):
05.02.2016 18:11
При включенной аутентификации по ключам если положить в другое место публичный ключ:

Код: Выделить всё

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile /home/jft/ssh/authorized_keys

<...>
При этом, если путь к ключам вернуть на более-менее дефолтный (для пользователя jf):

Код: Выделить всё

AuthorizedKeysFile /home/%u/ssh/authorized_keys

или

Код: Выделить всё

AuthorizedKeysFile /home/jft/ssh/authorized_keys

Не вижу разницы между первым и последним вариантами. Опечатка?
Пишите правильно:
в консоли
вку́пе (с чем-либо)
в общем
вообще
в течение (часа)
новичок
нюанс
по умолчанию
приемлемо
проблема
пробовать
трафик
Спасибо сказали:
sptica
Сообщения: 126
ОС: Ubuntu

Re: SSH не проходит аутентификацию по ключу

Сообщение sptica »

Bizdelnick писал(а):
05.02.2016 19:11
Не вижу разницы между первым и последним вариантами. Опечатка?


Да, извините. Должно быть вот так:

Код: Выделить всё

AuthorizedKeysFile /home/%u/ssh/authorized_keys

или

Код: Выделить всё

AuthorizedKeysFile /home/jf/ssh/authorized_keys


Исправил первый пост.

serzh-z писал(а):
05.02.2016 19:03
А что в `ls -la /`?

Код: Выделить всё

# ls / -la
total 14140
drwxrwxr-x  24 root root     4096 февр.  5 17:26 .
drwxrwxr-x  24 root root     4096 февр.  5 17:26 ..
drwxr-xr-x   2 root root     4096 мая   22  2015 bin
drwxr-xr-x   3 root root    12288 февр.  2 06:50 boot
drwxr-xr-x  18 root root     4460 февр.  2 06:50 dev
drwxr-xr-x 137 root root    12288 янв.  29 16:00 etc
drwxr-xr-x  14 root root     4096 февр.  5 18:23 home
lrwxrwxrwx   1 root root       33 февр.  2 06:49 initrd.img -> /boot/initrd.img-3.2.0-98-generic
lrwxrwxrwx   1 root root       33 дек.  19 06:43 initrd.img.old -> /boot/initrd.img-3.2.0-97-generic
drwxrwxr-x  25 root root     4096 мая   22  2015 lib
drwxr-xr-x   2 root root     4096 февр. 27  2015 lib64
drwx------   2 root root    16384 апр.  16  2012 lost+found
drwxr-xr-x   2 root root     4096 апр.  18  2012 media
drwxr-xr-x   2 root root        0 сент. 24 23:08 misc
drwxr-xr-x   8 root root     4096 мая   26  2015 mnt
drwxrwxr-x   5 root root     4096 июня  25  2013 opt
dr-xr-xr-x 193 root root        0 сент. 24 23:07 proc
-rw-------   1 root root 13033792 дек.  11  2013 restoresymtable
drwxr-s---  29 root root     4096 февр.  5 18:11 root
drwxr-xr-x  27 root root     1080 февр.  5 18:23 run
drwxr-xr-x   2 root root    12288 янв.  14 06:26 sbin
drwxr-xr-x   2 root root     4096 марта  5  2012 selinux
drwxr-xr-x   2 root root     4096 апр.  16  2012 srv
drwxr-xr-x  13 root root        0 сент. 24 23:07 sys
drwxrwxrwt  62 root root  1327104 февр.  5 19:21 tmp
drwxr-xr-x  11 root root     4096 апр.  17  2012 usr
drwxr-xr-x  13 root root     4096 сент. 24 23:07 var
lrwxrwxrwx   1 root root       29 февр.  2 06:49 vmlinuz -> boot/vmlinuz-3.2.0-98-generic
lrwxrwxrwx   1 root root       29 дек.  19 06:43 vmlinuz.old -> boot/vmlinuz-3.2.0-97-generic


Я, кстати тоже думал на эту тему. Сверил права на корень с соседней машиной, правда там версия убунты чуть постарше, пробовал в паре директорий убрать chmod g-w, не помогло. И на всякий пожарный:

Код: Выделить всё

# lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:    precise
Спасибо сказали:
Аватара пользователя
serzh-z
Бывший модератор
Сообщения: 8259
Статус: Маньяк
ОС: Arch, Fedora, Ubuntu

Re: SSH не проходит аутентификацию по ключу

Сообщение serzh-z »

QUOTE писал(а):drwxrwxr-x 24 root root 4096 февр. 5 17:26 .
SSH не запустится, если на любом каталоге в пути с ключами выставлен g+w. О чём, собственно, он и написал в сообщении об ошибке.
Спасибо сказали:
sptica
Сообщения: 126
ОС: Ubuntu

Re: SSH не проходит аутентификацию по ключу

Сообщение sptica »

serzh-z писал(а):
05.02.2016 19:22
drwxrwxr-x 24 root root 4096 февр. 5 17:26 .
SSH не запустится, если на любом каталоге в пути с ключами выставлен g+w. О чём, собственно, он и написал в сообщении об ошибке.

Нет.

/etc/ssh/sshd_config

Код: Выделить всё

AuthorizedKeysFile /home/jft/.ssh/authorized_keys

/home/jft# ls -la

Код: Выделить всё

total 12
drwxr-x---  3 jf   jf   4096 февр.  8 12:34 .
drwxr-xr-x 15 root root 4096 февр.  8 12:34 ..
drwx------  2 jf   jf   4096 февр.  5 18:23 .ssh

/var/log/auth.log

Код: Выделить всё

Feb  8 12:39:17 server2 sshd[507]: Authentication refused: bad ownership or modes for directory /


При этом отлично аутентифицируется по ключу при.
/etc/ssh/sshd_config

Код: Выделить всё

AuthorizedKeysFile /home/jf/.ssh/authorized_keys

/home/jf# ls -la

Код: Выделить всё

drwxr-x--- 18 jf   jf     4096 февр.  5 18:23 .
drwxr-xr-x 15 root root   4096 февр.  8 12:34 ..
drwx------  2 jf   jf     4096 февр.  5 18:23 .ssh

Спасибо сказали:
Аватара пользователя
Bizdelnick
Модератор
Сообщения: 21494
Статус: nulla salus bello
ОС: Debian GNU/Linux

Re: SSH не проходит аутентификацию по ключу

Сообщение Bizdelnick »

chmod g-w / помогает или нет?
Пишите правильно:
в консоли
вку́пе (с чем-либо)
в общем
вообще
в течение (часа)
новичок
нюанс
по умолчанию
приемлемо
проблема
пробовать
трафик
Спасибо сказали:
sptica
Сообщения: 126
ОС: Ubuntu

Re: SSH не проходит аутентификацию по ключу

Сообщение sptica »

Bizdelnick писал(а):
08.02.2016 12:59
chmod g-w / помогает или нет?


Да, помогло.

Не знал что у корня есть те-же биты прав, что и у всей остальной фс. Не додумался сделать

Код: Выделить всё

ls / -la


Спасибо!
Спасибо сказали:
Аватара пользователя
Bizdelnick
Модератор
Сообщения: 21494
Статус: nulla salus bello
ОС: Debian GNU/Linux

Re: SSH не проходит аутентификацию по ключу

Сообщение Bizdelnick »

sptica писал(а):
08.02.2016 16:34
Не додумался сделать

Код: Выделить всё

ls / -la

Так вот же:
sptica писал(а):
05.02.2016 19:17
serzh-z писал(а):
05.02.2016 19:03
А что в `ls -la /`?

Код: Выделить всё

# ls / -la
total 14140
drwxrwxr-x  24 root root     4096 февр.  5 17:26 .
drwxrwxr-x  24 root root     4096 февр.  5 17:26 ..
drwxr-xr-x   2 root root     4096 мая   22  2015 bin
drwxr-xr-x   3 root root    12288 февр.  2 06:50 boot
drwxr-xr-x  18 root root     4460 февр.  2 06:50 dev
drwxr-xr-x 137 root root    12288 янв.  29 16:00 etc
drwxr-xr-x  14 root root     4096 февр.  5 18:23 home
lrwxrwxrwx   1 root root       33 февр.  2 06:49 initrd.img -> /boot/initrd.img-3.2.0-98-generic
lrwxrwxrwx   1 root root       33 дек.  19 06:43 initrd.img.old -> /boot/initrd.img-3.2.0-97-generic
drwxrwxr-x  25 root root     4096 мая   22  2015 lib
drwxr-xr-x   2 root root     4096 февр. 27  2015 lib64
drwx------   2 root root    16384 апр.  16  2012 lost+found
drwxr-xr-x   2 root root     4096 апр.  18  2012 media
drwxr-xr-x   2 root root        0 сент. 24 23:08 misc
drwxr-xr-x   8 root root     4096 мая   26  2015 mnt
drwxrwxr-x   5 root root     4096 июня  25  2013 opt
dr-xr-xr-x 193 root root        0 сент. 24 23:07 proc
-rw-------   1 root root 13033792 дек.  11  2013 restoresymtable
drwxr-s---  29 root root     4096 февр.  5 18:11 root
drwxr-xr-x  27 root root     1080 февр.  5 18:23 run
drwxr-xr-x   2 root root    12288 янв.  14 06:26 sbin
drwxr-xr-x   2 root root     4096 марта  5  2012 selinux
drwxr-xr-x   2 root root     4096 апр.  16  2012 srv
drwxr-xr-x  13 root root        0 сент. 24 23:07 sys
drwxrwxrwt  62 root root  1327104 февр.  5 19:21 tmp
drwxr-xr-x  11 root root     4096 апр.  17  2012 usr
drwxr-xr-x  13 root root     4096 сент. 24 23:07 var
lrwxrwxrwx   1 root root       29 февр.  2 06:49 vmlinuz -> boot/vmlinuz-3.2.0-98-generic
lrwxrwxrwx   1 root root       29 дек.  19 06:43 vmlinuz.old -> boot/vmlinuz-3.2.0-97-generic

Пишите правильно:
в консоли
вку́пе (с чем-либо)
в общем
вообще
в течение (часа)
новичок
нюанс
по умолчанию
приемлемо
проблема
пробовать
трафик
Спасибо сказали:
sptica
Сообщения: 126
ОС: Ubuntu

Re: SSH не проходит аутентификацию по ключу

Сообщение sptica »

Bizdelnick писал(а):
08.02.2016 16:48
sptica писал(а):
08.02.2016 16:34
Не додумался сделать

Код: Выделить всё

ls / -la

Так вот же:
sptica писал(а):
05.02.2016 19:17
serzh-z писал(а):
05.02.2016 19:03
А что в `ls -la /`?

Код: Выделить всё

# ls / -la
total 14140
drwxrwxr-x  24 root root     4096 февр.  5 17:26 .
drwxrwxr-x  24 root root     4096 февр.  5 17:26 ..
drwxr-xr-x   2 root root     4096 мая   22  2015 bin
drwxr-xr-x   3 root root    12288 февр.  2 06:50 boot
drwxr-xr-x  18 root root     4460 февр.  2 06:50 dev
drwxr-xr-x 137 root root    12288 янв.  29 16:00 etc
drwxr-xr-x  14 root root     4096 февр.  5 18:23 home
lrwxrwxrwx   1 root root       33 февр.  2 06:49 initrd.img -> /boot/initrd.img-3.2.0-98-generic
lrwxrwxrwx   1 root root       33 дек.  19 06:43 initrd.img.old -> /boot/initrd.img-3.2.0-97-generic
drwxrwxr-x  25 root root     4096 мая   22  2015 lib
drwxr-xr-x   2 root root     4096 февр. 27  2015 lib64
drwx------   2 root root    16384 апр.  16  2012 lost+found
drwxr-xr-x   2 root root     4096 апр.  18  2012 media
drwxr-xr-x   2 root root        0 сент. 24 23:08 misc
drwxr-xr-x   8 root root     4096 мая   26  2015 mnt
drwxrwxr-x   5 root root     4096 июня  25  2013 opt
dr-xr-xr-x 193 root root        0 сент. 24 23:07 proc
-rw-------   1 root root 13033792 дек.  11  2013 restoresymtable
drwxr-s---  29 root root     4096 февр.  5 18:11 root
drwxr-xr-x  27 root root     1080 февр.  5 18:23 run
drwxr-xr-x   2 root root    12288 янв.  14 06:26 sbin
drwxr-xr-x   2 root root     4096 марта  5  2012 selinux
drwxr-xr-x   2 root root     4096 апр.  16  2012 srv
drwxr-xr-x  13 root root        0 сент. 24 23:07 sys
drwxrwxrwt  62 root root  1327104 февр.  5 19:21 tmp
drwxr-xr-x  11 root root     4096 апр.  17  2012 usr
drwxr-xr-x  13 root root     4096 сент. 24 23:07 var
lrwxrwxrwx   1 root root       29 февр.  2 06:49 vmlinuz -> boot/vmlinuz-3.2.0-98-generic
lrwxrwxrwx   1 root root       29 дек.  19 06:43 vmlinuz.old -> boot/vmlinuz-3.2.0-97-generic




Действительно. Не обратил внимание на первую строку и на то, что у корня тоже есть rwx биты.
Спасибо сказали: