ssh连接问题

在服务器已经配置了authorized_keys,但是还是要输入密码。

打印ssh -vvT

debug1: Host 'IP' is known and matches the ECDSA host key.
debug1: Found key in /home/xiaoyuhao/.ssh/known_hosts:7
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug2: key: /home/xiaoyuhao/.ssh/id_rsa (0x562f85e720f0), agent
debug2: key: id_rsa (0x562f85e81560), agent
debug2: key: /home/xiaoyuhao/.ssh/id_dsa ((nil))
debug2: key: /home/xiaoyuhao/.ssh/id_ecdsa ((nil))
debug2: key: /home/xiaoyuhao/.ssh/id_ed25519 ((nil))
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug2: we did not send a packet, disable method
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available

debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available

debug1: Unspecified GSS failure.  Minor code may provide more information


debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available

debug2: we did not send a packet, disable method
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/xiaoyuhao/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Offering RSA public key: id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/xiaoyuhao/.ssh/id_dsa
debug1: Trying private key: /home/xiaoyuhao/.ssh/id_ecdsa
debug1: Trying private key: /home/xiaoyuhao/.ssh/id_ed25519
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
git@’IP‘'s password: 
debug2: we sent a password packet, wait for reply


debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
Permission denied, please try again.
git@66.98.121.162's password: 
debug2: we sent a password packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password

我在.ssh目录下有

xiaoyuhao@xiaoyuhao-Vostro-5460:~/.ssh$ ls
id_rsa  id_rsa.pub  known_hosts

却不能校验

阅读 4.5k
2 个回答

网络上大部分教程不完整导致。。。因我是git用户要给.ssh 755权限。才可使用。但大多教程700导致。

这个提示不影响登录的,你如果需要ssh登录服务器那么需要把你的id_rsa.pub即公钥内容配置到服务器对应用户名下的.ssh目录中的authorized_keys文件中。

如果配置了不能登录:

  1. 检查用户名是否正确;
  2. 服务器配置/etc/ssh/sshd_config是否允许通过key登录;
  3. 确认authorized_keys配置的你的公钥是否正确,一条key记录不允许出现换行。

clipboard.png
这是我本地的日志,不影响登录的啊,你ssh登录的时候需要用命令:

ssh username@xxx.com

你的登录用户名设置正确吗?
都检查下吧!

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题