環境:阿里雲Centos 6.5,客戶端msysgit最新版。
主要參考文章:http://freeloda.blog.51cto.com/2033581/1410562
遇到問題參考的鏈接,/q/1010000000445726
問題依舊。
問題:公鑰已配置,且已拷貝到正確目錄。 git clone時提示輸入密碼。
萬分著急。希望高手幫忙! ! !
$ git clone git@42.96.xxx.xxx:/opt/data/git/zebenrepos.git
應要求,上msysgit 命令列使用ssh -vvv模式抓取的日誌:
第一段:
zxl@ZXL-THINK /c
$ ssh -vvv git@42.96.1xx.2xx
第二段:
debug2: key: /c/Users/zxl/.ssh/id_ecdsa (0x0),
debug2: key: /c/Users/zxl/.ssh/id_ed25519 (0x0),
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mi
c,password
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-m
ic,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/zxl/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mi
c,password
debug1: Trying private key: /c/Users/zxl/.ssh/id_dsa
debug3: no such identity: /c/Users/zxl/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /c/Users/zxl/.ssh/id_ecdsa
debug3: no such identity: /c/Users/zxl/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /c/Users/zxl/.ssh/id_ed25519
debug3: no such identity: /c/Users/zxl/.ssh/id_ed25519: No such file or director
y
debug2: we did not send a packet, disable method
第二段中懷疑沒有嘗試rsa,故第三段換了dsa
第三段
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/zxl/.ssh/id_rsa
debug3: no such identity: /c/Users/zxl/.ssh/id_rsa: No such file or directory
debug1: Offering DSA public key: /c/Users/zxl/.ssh/id_dsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mi
c,password
debug1: Trying private key: /c/Users/zxl/.ssh/id_ecdsa
debug3: no such identity: /c/Users/zxl/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /c/Users/zxl/.ssh/id_ed25519
debug3: no such identity: /c/Users/zxl/.ssh/id_ed25519: No such file or director
y
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
git@42.96.1xx.2xx's password:
看看這日誌,實在沒搞懂,為什麼dsa已經試通了,還去輸入密碼?
黄舟2017-04-26 09:03:56
總結一下:(1)、Centos下,此問題出現與s_home_t的目錄標籤無很大關係,與SELinux也沒有很大關係。本人機器.ssh根本就沒有標籤,也沒修改selinux配置。
(2)、參考網路上的教學要十分小心。初步分析問題出現在編輯/etc/passwd中停用git ssh存取:
注意:下面一行的兩個數字(應該是UID吧),一定要跟原來的(上面一行註解掉的)一樣。如果粗心大意,怎麼也想不到問題出在這裡!