Мы используем Backuppc в нашем маленьком офисе, с набором ПК с Windows 7 и некоторыми пользователями, использующими свои Macbooks. Backuppc сидит на сервере под управлением Ubuntu 12.04.2. Безпарольный ssh отлично работает со Snow Leopard и Lion, но я борюсь с Mountain Lion, так как он снова и снова спрашивает пароль. Я следовал процедуре обмена открытыми ключами rsa и добавил открытый ключ от пользователя Backuppc на хост-компьютер Mountain Lion. Сначала я добавил ключ к файлу authorized_keys2 в каталоге .ssh. Это не работает. После некоторых поисков некоторые люди предложили использовать вместо этого «author_keys», так как кажется, что Mountain Lion обновил пакет sshd. Это тоже не сработало. Я думаю, что права установлены правильно как для каталога .ssh (700), так и для файла authorized_keys (под редакцией: 644). Он постоянно запрашивает пароль каждый раз, когда я пытаюсь выполнить ssh от пользователя Backuppc к машине с Mountain Lion. Действительно раздражает. Ниже я прилагаю выходные данные отладки на случай, если кто-нибудь может дать некоторые подсказки. Большое спасибо за Вашу помощь.
backuppc@ubuntu:~$ ssh -v user1@192.168.10.55
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.10.55 [192.168.10.55] port 22.
debug1: Connection established.
debug1: identity file /var/lib/backuppc/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /var/lib/backuppc/.ssh/id_rsa-cert type -1
debug1: identity file /var/lib/backuppc/.ssh/id_dsa type -1
debug1: identity file /var/lib/backuppc/.ssh/id_dsa-cert type -1
debug1: identity file /var/lib/backuppc/.ssh/id_ecdsa type -1
debug1: identity file /var/lib/backuppc/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9
debug1: match: OpenSSH_5.9 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 4c:c3:21:8f:6e:59:60:a9:5f:94:75:01:2d:e2:03:3e
debug1: Host '192.168.10.55' is known and matches the RSA host key.
debug1: Found key in /var/lib/backuppc/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /var/lib/backuppc/.ssh/id_rsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /var/lib/backuppc/.ssh/id_dsa
debug1: Trying private key: /var/lib/backuppc/.ssh/id_ecdsa
debug1: Next authentication method: keyboard-interactive
Password:
Следуя советам по комментариям, я запустил 'sshd -d' на целевой машине Mountain Lion. Сначала я остановил ssh, а затем запустил sshd -d. Я вставляю вам результаты ниже:
$sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
$sudo /usr/sbin/sshd -d
debug1: sshd version OpenSSH_5.9p1
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'
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: fd 6 clearing O_NONBLOCK
debug1: Server will not fork when running in debugging mode.
debug1: rexec start in 6 out 6 newsock 6 pipe -1 sock 9
debug1: inetd sockets after dupping: 5, 5
Connection from 192.168.10.100 port 34179
debug1: Client protocol version 2.0; client software version OpenSSH_5.9p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9
debug1: permanently_set_uid: 75/75 [preauth]
debug1: list_hostkey_types: ssh-rsa,ssh-dss [preauth]
debug1: SSH2_MSG_KEXINIT sent [preauth]
debug1: SSH2_MSG_KEXINIT received [preauth]
debug1: kex: client->server aes128-ctr hmac-md5 none [preauth]
debug1: kex: server->client aes128-ctr hmac-md5 none [preauth]
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received [preauth]
debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent [preauth]
debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT [preauth]
debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent [preauth]
debug1: SSH2_MSG_NEWKEYS sent [preauth]
debug1: expecting SSH2_MSG_NEWKEYS [preauth]
debug1: SSH2_MSG_NEWKEYS received [preauth]
debug1: KEX done [preauth]
debug1: userauth-request for user user1 service ssh-connection method none [preauth]
debug1: attempt 0 failures 0 [preauth]
debug1: PAM: initializing for "user1"
debug1: PAM: setting PAM_RHOST to "ubuntu"
debug1: userauth-request for user user1 service ssh-connection method publickey [preauth]
debug1: attempt 1 failures 0 [preauth]
debug1: test whether pkalg/pkblob are acceptable [preauth]
debug1: temporarily_use_uid: 502/20 (e=0/0)
debug1: trying public key file /Users/user1/.ssh/authorized_keys
debug1: fd 6 clearing O_NONBLOCK
Authentication refused: bad ownership or modes for directory /Users/user1
debug1: restore_uid: 0/0
debug1: temporarily_use_uid: 502/20 (e=0/0)
debug1: trying public key file /Users/user1/.ssh/authorized_keys2
debug1: fd 6 clearing O_NONBLOCK
Authentication refused: bad ownership or modes for directory /Users/user1
debug1: restore_uid: 0/0
Failed publickey for user1 from 192.168.10.100 port 34179 ssh2
debug1: audit_event: unhandled event 6
debug1: userauth-request for user user1 service ssh-connection method keyboard-interactive [preauth]
debug1: attempt 2 failures 1 [preauth]
debug1: keyboard-interactive devs [preauth]
debug1: auth2_challenge: user=user1 devs= [preauth]
debug1: kbdint_alloc: devices 'pam' [preauth]
debug1: auth2_challenge_start: trying authentication method 'pam' [preauth]
Postponed keyboard-interactive for user1 from 192.168.10.100 port 34179 ssh2 [preauth]
debug1: do_pam_account: called
debug1: PAM: num PAM env strings 2
Postponed keyboard-interactive/pam for user1 from 192.168.10.100 port 34179 ssh2 [preauth]
debug1: do_pam_account: called
Accepted keyboard-interactive/pam for user1 from 192.168.10.100 port 34179 ssh2
debug1: monitor_read_log: child log fd closed
debug1: monitor_child_preauth: user1 has been authenticated by privileged process
debug1: PAM: establishing credentials
User child is on pid 3240
debug1: PAM: establishing credentials
debug1: permanently_set_uid: 502/20
debug1: Entering interactive session for SSH2.
debug1: server_init_dispatch_20
debug1: server_input_channel_open: ctype session rchan 0 win 1048576 max 16384
debug1: input_session_request
debug1: channel 0: new [server-session]
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0
debug1: server_input_channel_req: channel 0 request pty-req reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req pty-req
debug1: Allocating pty.
debug1: session_new: session 0
debug1: session_pty_req: session 0 alloc /dev/ttys001
debug1: Ignoring unsupported tty mode opcode 37 (0x25)
debug1: Ignoring unsupported tty mode opcode 52 (0x34)
debug1: Ignoring unsupported tty mode opcode 71 (0x47)
debug1: server_input_channel_req: channel 0 request env reply 0
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req env
debug1: server_input_channel_req: channel 0 request shell reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req shell
debug1: Setting controlling tty using TIOCSCTTY.