鍍金池/ 問(wèn)答/Linux/ ssh連接問(wèn)題

ssh連接問(wèn)題

在服務(wù)器已經(jīng)配置了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

卻不能校驗(yàn)

回答
編輯回答
蝶戀花

網(wǎng)絡(luò)上大部分教程不完整導(dǎo)致。。。因我是git用戶要給.ssh 755權(quán)限。才可使用。但大多教程700導(dǎo)致。

2017年6月15日 10:05
編輯回答
伴謊

這個(gè)提示不影響登錄的,你如果需要ssh登錄服務(wù)器那么需要把你的id_rsa.pub即公鑰內(nèi)容配置到服務(wù)器對(duì)應(yīng)用戶名下的.ssh目錄中的authorized_keys文件中。

如果配置了不能登錄:

  1. 檢查用戶名是否正確;
  2. 服務(wù)器配置/etc/ssh/sshd_config是否允許通過(guò)key登錄;
  3. 確認(rèn)authorized_keys配置的你的公鑰是否正確,一條key記錄不允許出現(xiàn)換行。

clipboard.png
這是我本地的日志,不影響登錄的啊,你ssh登錄的時(shí)候需要用命令:

ssh username@xxx.com

你的登錄用戶名設(shè)置正確嗎?
都檢查下吧!

2017年6月17日 03:00