簡體   English   中英

SSH要求輸入用戶密碼而不是ssh密鑰密碼?

[英]SSH asking for user password instead of ssh key passphrase?

當我嘗試SSH進入遠程服務器時,有時我的終端會要求我輸入用戶名密碼,有時會要求我輸入ssh密鑰密碼。 這正常嗎? 我怎么總是只要求ssh密鑰密碼?

我在Windows上使用Gitbash。 我正在使用配置文件指定主機。

我的配置文件設置如下:

Host remoteservername
    Hostname serverbox.net
    User samplename
    IdentityFile ~/.ssh/id_rsa
    IdentitiesOnly yes

然后在執行ssh:

ssh remoteservername

有時我會得到以下信息:

samplename@remoteservername's password: 

其他時候我找回我想要的密碼要求:

Enter passphtase for key 'c/Users/name/.ssh/id_rsa'

用戶名密碼又長又復雜,因此理想情況下,我總是希望僅使用ssh密鑰。

當前設置有效,除了隨機詢問用戶名密碼而不是關鍵字時。

更新:

根據VonC,我運行ssh -Tvv並比較了成功返回和錯誤返回的日志。 直到最后,大多數日志都是相同的。 嘗試要求輸入用戶名密碼的嘗試有以下幾行:

debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
samplename@serverbox.net's password:

正確的響應返回這些行:

debug1: Server accepts key: pkalg rsa-sha2-512 blen 279
debug2: input_userauth_pk_ok: fp SHA256:{KEY HERE}
Enter passphrase for key '/c/Users/name/.ssh/id_rsa':

我的ssh本身可能有問題嗎? 還是服務器上的配置問題?

多次嘗試使用ssh -Tvv remoteservername來查看成功會話與默認返回用戶密碼的會話之間是否存在任何區別。

仔細檢查您的PATH,看看問題是否在使用簡化的PATH啟動的會話中仍然存在( 如此處所示

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM