ssh 错误:权限被拒绝(键盘交互)

ssh 错误:权限被拒绝(键盘交互)

我尝试通过ssh(从 OS X 10.9.5)访问远程系统,但失败了。我的 ~/.ssh 目录是空的。

 user@wcw-eduroam-XXX-XXX-XXX-XXX:~$ ssh -vvv [email protected]
 OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
 debug1: Reading configuration data /etc/ssh_config
 debug1: /etc/ssh_config line 20: Applying options for *
 debug1: /etc/ssh_config line 102: Applying options for *
 debug2: ssh_connect: needpriv 0
 debug1: Connecting to address.of.domain [XXX.XX.XXX.XXX] port 22.
 debug1: Connection established.
 debug1: identity file /Users/user/.ssh/id_rsa type -1
 debug1: identity file /Users/user/.ssh/id_rsa-cert type -1
 debug1: identity file /Users/user/.ssh/id_dsa type -1
 debug1: identity file /Users/user/.ssh/id_dsa-cert type -1
 debug1: Enabling compatibility mode for protocol 2.0
 debug1: Local version string SSH-2.0-OpenSSH_6.2
 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
 debug1: match: OpenSSH_5.3 pat OpenSSH_5*
 debug2: fd 3 setting O_NONBLOCK
 debug1: SSH2_MSG_KEXINIT sent
 debug1: SSH2_MSG_KEXINIT received
 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: [email protected],[email protected],[email protected],[email protected],ssh-rsa,ssh-dss
 debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
 debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
 debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
 debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
 debug2: kex_parse_kexinit: none,[email protected],zlib
 debug2: kex_parse_kexinit: none,[email protected],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
 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,[email protected]
 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,[email protected]
 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
 debug2: kex_parse_kexinit: none,[email protected]
 debug2: kex_parse_kexinit: none,[email protected]
 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<8192) sent
 debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
 debug2: dh_gen_key: priv key bits set: 133/256
 debug2: bits set: 499/1024
 debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
 debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
 debug1: Server host key: RSA dc:94:dc:9b:02:8a:8f:9a:07:de:b4:ca:d3:80:65:04
 The authenticity of host 'address.of.domain (146.50.188.202)' can't be established.
 RSA key fingerprint is dc:94:dc:9b:02:8a:8f:9a:07:de:b4:ca:d3:80:65:04.
 Are you sure you want to continue connecting (yes/no)? yes
 Warning: Permanently added 'address.of.domain,146.50.188.202' (RSA) to the list of known hosts.
 debug2: bits set: 527/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
 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: /Users/user/.ssh/id_rsa (0x7fe8e940c740),
 debug2: key: /Users/user/.ssh/id_rsa (0x0),
 debug2: key: /Users/user/.ssh/id_dsa (0x0),
 debug3: input_userauth_banner

 debug1: Authentications that can continue: keyboard-interactive
 debug3: start over, passed a different list keyboard-interactive
 debug3: preferred publickey,keyboard-interactive,password
 debug3: authmethod_lookup keyboard-interactive
 debug3: remaining preferred: password
 debug3: authmethod_is_enabled keyboard-interactive
 debug1: Next authentication method: keyboard-interactive
 debug2: userauth_kbdint
 debug2: we sent a keyboard-interactive packet, wait for reply
 debug1: Authentications that can continue: keyboard-interactive
 debug3: userauth_kbdint: disable: no info_req_seen
 debug2: we did not send a packet, disable method
 debug1: No more authentication methods to try.
 Permission denied (keyboard-interactive)

答案1

SSH 一般采用两种认证方式:用户名-密码组合和用户名-公钥组合。

看来您的服务器仅支持用户名-公钥身份验证。请咨询您的管理员。如果我没记错的话,请向他索取与您的用户名相关的公钥,然后使用公钥登录。

答案2

如果你已为密钥和 2FA(使用 google 身份验证)配置了服务器,则需要为每个密钥和 2FA 启用 2FA用户

使用工作用户登录服务器

su user

google-authenticator 

按照所有步骤

答案3

很抱歉发帖,但这对我有用,而且我还没有在任何其他容易返回的搜索结果中找到此解决方案(希望它能够对其他人有所帮助):

我有一个网页,其服务器通过 ssh 访问其他“节点”(即其他服务器)。因此,当在服务器上执行 ssh 时,它以用户“apache”的身份执行(显然 Apache 正在服务器上运行)。

当尝试访问某些节点时,返回“权限被拒绝(键盘交互)”。

在服务器上编辑 /etc/passwd 解决了该问题。更改:

apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin

到:

apache:x:48:48:Apache:/usr/share/httpd:/bin/bash

相关内容