================================================== ==================
更新:原来在host2上的sshd的configuration不会允许密码login。 感谢人们回答了这个问题。
================================================== ==================
情景:与我的大学项目公司合作。 我需要首先使用PuTTy SSH进入host1 ,然后从那里通过SSH进入host2 (见下文)。 我在host2上获得了一个用户名和密码。
我根本没有访问host2,所以我不知道它的sshd_config 。
当我尝试从host1进入host2时发生了这种情况:
ff@host1:~$ ssh -v host2 OpenSSH_5.1p1 Debian-5, OpenSSL 0.9.8g 19 Oct 2007 debug1: Reading configuration data /home/ff/.ssh/config debug1: Applying options for * debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to host2 [192.*.*.*] port 22. debug1: Connection established. debug1: identity file /home/ff/.ssh/identity type -1 debug1: identity file /home/ff/.ssh/id_rsa type -1 debug1: identity file /home/ff/.ssh/id_dsa type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3 debug1: match: OpenSSH_4.3 pat OpenSSH_4* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-5 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc 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: Host 'sd01' is known and matches the RSA host key. debug1: Found key in /home/ff/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,gssapi-with-mic,password debug1: Next authentication method: gssapi-with-mic debug1: Unspecified GSS failure. Minor code may provide more information No credentials cache found debug1: Unspecified GSS failure. Minor code may provide more information No credentials cache found debug1: Unspecified GSS failure. Minor code may provide more information debug1: Next authentication method: publickey debug1: Trying private key: /home/ff/.ssh/identity debug1: Trying private key: /home/ff/.ssh/id_rsa debug1: Trying private key: /home/ff/.ssh/id_dsa debug1: Next authentication method: password ff@sd01's password: debug1: Authentications that can continue: publickey,gssapi-with-mic,password Permission denied, please try again. ff@sd01's password: debug1: Authentications that can continue: publickey,gssapi-with-mic,password Permission denied, please try again. ff@sd01's password: debug1: Authentications that can continue: publickey,gssapi-with-mic,password debug1: No more authentication methods to try. Permission denied (publickey,gssapi-with-mic,password).
和我的/home/ff/.ssh/config:
Host * # ForwardAgent no # ForwardX11 no # ForwardX11Trusted yes # RhostsRSAAuthentication no # RSAAuthentication yes # HostbasedAuthentication no BatchMode no # CheckHostIP yes # AddressFamily any # ConnectTimeout 0 # StrictHostKeyChecking ask # IdentityFile ~/.ssh/identity # IdentityFile ~/.ssh/id_rsa # IdentityFile ~/.ssh/id_dsa # Port 22 # Protocol 2,1 # AuthorizedKeysFile .ssh/authorized_keys # Cipher 3des # Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc # EscapeChar ~ # Tunnel no # TunnelDevice any:any # PermitLocalCommand no SendEnv LANG LC_* HashKnownHosts yes GSSAPIAuthentication yes GSSAPIDelegateCredentials no
我不知道在去公司之前有什么可以做的。
您尝试使用的用户名和密码不被主机接受。 这意味着要么连接到错误的服务器,要么用户名或密码不正确。 你应该要求pipe理员检查host2上的日志,这应该告诉你哪一个是这种情况。
在我的情况下,这是由主目录的encryption引起的。 我已经改变了ssh密钥的位置,它解决了这个问题:(Web Archive copy) http://tweaktheserver.com/ssh-cant-connect-authentications-that-can-continue-publickeygssapi-keyexgssapi-with-micpassword/
GSSAPIauthentication似乎在客户端启用,但它失败,并回落到密码authentication。 如果您无法使用提供的login名和密码进行login,则唯一明智的做法是联系负责pipe理服务器的人员(“公司”)。
我有同样的问题,但是我的问题是操作系统(CentOS 7)的默认configuration是encryption用户目录,以便置于~/.ssh/中的authorized_keys文件不起作用。 解决scheme来自这里,但基本上:
/etc/ssh/sshd_config将AuthorizedKeysFile属性设置为用户目录之外的内容( /etc/ssh/authorized_keys ) 你可以试试
ssh server -l user -o "PubkeyAuthentication=no"
或者在/ etc / ssh / sshd_config中添加/修改属性
PermitRootLogin yes
第一
chmod 700 .ssh
接着 :
chmod 600 .ssh/authorized_keys
并testing这个:
restorecon -r -vv .ssh/authorized_keys