国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

ssh登錄出現(xiàn)Permission denied, please try again可能的解決方案

這篇具有很好參考價(jià)值的文章主要介紹了ssh登錄出現(xiàn)Permission denied, please try again可能的解決方案。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

問(wèn)題描述

  • 環(huán)境:ubuntu 20.04
  • 問(wèn)題描述:在已經(jīng)設(shè)置免密登錄后,ssh登錄時(shí)(例如ssh localhost)還需要輸入密碼,并且輸入密碼后出現(xiàn)下面一系列的報(bào)錯(cuò):
xxx(用戶名)@localhost's password: 
Permission denied, please try again.
xxx@localhost's password: 
Permission denied, please try again.
xxx@localhost's password: 
xxx@localhost: Permission denied (publickey,password).

問(wèn)題排查

首先使用命令ssh localhost -v查看登錄時(shí)的日志:

OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /home/yhy/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/yhy/.ssh/id_rsa type 0
debug1: identity file /home/yhy/.ssh/id_rsa-cert type -1
debug1: identity file /home/yhy/.ssh/id_dsa type 1
debug1: identity file /home/yhy/.ssh/id_dsa-cert type -1
debug1: identity file /home/yhy/.ssh/id_ecdsa type -1
debug1: identity file /home/yhy/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/yhy/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/yhy/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/yhy/.ssh/id_ed25519 type -1
debug1: identity file /home/yhy/.ssh/id_ed25519-cert type -1
debug1: identity file /home/yhy/.ssh/id_ed25519_sk type -1
debug1: identity file /home/yhy/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/yhy/.ssh/id_xmss type -1
debug1: identity file /home/yhy/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.5 pat OpenSSH* compat 0x04000000
debug1: Authenticating to localhost:22 as 'yhy'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-ed25519 SHA256:KgNVsJSzDmK9KHR57LTY2Xarsui27l0FIm9CY2fUO6o
debug1: Host 'localhost' is known and matches the ED25519 host key.
debug1: Found key in /home/yhy/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/yhy/.ssh/id_dsa DSA SHA256:G/HRSEJY5SzAo4ejVp+GVHkIp+UjzMTETklcP2P0ym4 agent
debug1: Will attempt key: /home/yhy/.ssh/id_rsa RSA SHA256:ysy/bD0PakYR49V2kxCs95GxfpHjLifTAPqNJ5yH480 agent
debug1: Will attempt key: /home/yhy/.ssh/id_ecdsa 
debug1: Will attempt key: /home/yhy/.ssh/id_ecdsa_sk 
debug1: Will attempt key: /home/yhy/.ssh/id_ed25519 
debug1: Will attempt key: /home/yhy/.ssh/id_ed25519_sk 
debug1: Will attempt key: /home/yhy/.ssh/id_xmss 
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/yhy/.ssh/id_dsa DSA SHA256:G/HRSEJY5SzAo4ejVp+GVHkIp+UjzMTETklcP2P0ym4 agent
debug1: Authentications that can continue: publickey,password
debug1: Offering public key: /home/yhy/.ssh/id_rsa RSA SHA256:ysy/bD0PakYR49V2kxCs95GxfpHjLifTAPqNJ5yH480 agent
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/yhy/.ssh/id_ecdsa
debug1: Trying private key: /home/yhy/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/yhy/.ssh/id_ed25519
debug1: Trying private key: /home/yhy/.ssh/id_ed25519_sk
debug1: Trying private key: /home/yhy/.ssh/id_xmss
debug1: Next authentication method: password

從日志上看,應(yīng)該還是配置的問(wèn)題。

可能的原因

  • 配置問(wèn)題:如果是ssh配置的問(wèn)題首先可以嘗試這里修改配置。(如果之前從未修改過(guò)相關(guān)配置,大概率不是這里的問(wèn)題)
    進(jìn)行上面的方法后,如果還不行,說(shuō)明不是配置文件的問(wèn)題。
  • 文件權(quán)限問(wèn)題:有時(shí)文件權(quán)限也可能會(huì)導(dǎo)致登錄失敗,按照上述方法查看日志后,如果日志中出現(xiàn)有關(guān)文件權(quán)限的錯(cuò)誤badownership,那么就要考慮.ssh文件夾和authorized_keys文件的權(quán)限問(wèn)題了。
    進(jìn)入.ssh文件夾下,使用如下命令查看文件夾的信息:
    ll -ld
    
    drwx------ 3 xxx xxx 4096 53 08:41 ./
    
    該目錄必須具有上面所示的讀(r)、寫(w)、執(zhí)行(x) 權(quán)限,如果沒(méi)有則需要使用命令:
    chmod 0700 /home/your_home/.ssh
    
    修改權(quán)限;
    使用命令:
    /home/xxx/.ssh$ ls -ld authorized_keys
    
    -rw------- 1 yhy yhy 564 53 07:08 authorized_keys
    
    查看文件authorized_keys的文件權(quán)限。該文件必須有上面所示的讀寫(rw) 權(quán)限,否則使用命令:
    chmod 0600 /home/[username]/.ssh/authorized_keys
    
    修改權(quán)限。
  • zsh問(wèn)題:如果上述方法都不奏效,且你正在/曾經(jīng)使用zsh那么恭喜你可能遇到了和我相同的問(wèn)題。這個(gè)問(wèn)題可以通過(guò)命令
    service sshd status
    
    查看ssh服務(wù)運(yùn)行狀態(tài)發(fā)現(xiàn),如果運(yùn)行日志中有:
    User xxx not allowed because shell /bin/zsh
    
    那么就是由于zsh使用問(wèn)題導(dǎo)致。我的問(wèn)題是之前使用過(guò) zsh,卸載后忘記修改默認(rèn)終端,導(dǎo)致ssh出現(xiàn)問(wèn)題。
    首先查看系統(tǒng)可用終端:
$ cat /etc/shells

# /etc/shells: valid login shells
/bin/sh
/bin/bash
/usr/bin/bash
/bin/rbash
/usr/bin/rbash
/bin/dash
/usr/bin/dash
/bin/zsh
/usr/bin/zsh

可以看到由于之前設(shè)置過(guò)該文件,所以里面有bin/zshusr/bin/zsh,如果zsh已經(jīng)卸載的話,可以刪除后面這兩行。
通過(guò)命令sudo nautilus可以以管理員身份打開(kāi)文件夾,并且任意對(duì)里面的文件進(jìn)行修改。
接下來(lái)查看系統(tǒng)默認(rèn)shell

$ echo $SHELL
/bin/zsh

可以看到還是因?yàn)橹暗脑O(shè)置,默認(rèn)shellzsh。通過(guò)命令:

grep xxx(你的用戶名) /etc/passwd #這條命令顯示/etc/passwd中用戶的終端設(shè)置

sudo chsh --shell /bin/bash xxx #這條命令修改用戶的默認(rèn)終端為/bin/bash

grep xxx /etc/passwd #再次查看,默認(rèn)終端已經(jīng)變成/bin/bash

在用戶登錄時(shí),系統(tǒng)會(huì)根據(jù)/etc/passwd中的設(shè)置為用戶設(shè)置默認(rèn)終端,所以執(zhí)行完上述操作后重啟,再次檢查默認(rèn)終端:

echo $SHELL
/bin/bash

會(huì)發(fā)現(xiàn)終端已經(jīng)改成了/bin/bash。
這時(shí)候再試一試ssh localhost,會(huì)發(fā)現(xiàn)登錄成功:
ssh登錄出現(xiàn)Permission denied, please try again可能的解決方案
問(wèn)題得到解決。

如果上面的方法都不能解決,就要根據(jù)日志和服務(wù)狀態(tài)信息中的其它內(nèi)容進(jìn)行排查了。

總結(jié)

這個(gè)ssh登錄失敗問(wèn)題困擾了我很長(zhǎng)時(shí)間,試了網(wǎng)上很多種方法都沒(méi)有奏效,最后查看系統(tǒng)服務(wù)日志才發(fā)現(xiàn)問(wèn)題所在。以后刪除某個(gè)軟件的時(shí)候,一定要把相關(guān)的配置還原成為默認(rèn)的,否則不知道哪天會(huì)出問(wèn)題!文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-489784.html

到了這里,關(guān)于ssh登錄出現(xiàn)Permission denied, please try again可能的解決方案的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 用戶ssh正確密碼登陸樹莓派鏡像均報(bào)錯(cuò)Permission denied, please try again.處理方法

    一個(gè)樹莓派鏡像,啟動(dòng)后發(fā)現(xiàn)沒(méi)有 sshd 功能,于是 啟用 openssh,重新啟動(dòng),又發(fā)現(xiàn)樹莓派拒絕 ssh 連接請(qǐng)求。 我的一臺(tái)樹莓派IP是:192.168.59.133任何服務(wù)器使用任何用戶ssh均報(bào)錯(cuò),甚至連自己都不能ssh自己。 不能使用任何工具連接上該服務(wù)器 使用ssh連接自己的127.0.0.1和localh

    2024年01月22日
    瀏覽(21)
  • Git 解決 Permission denied, please try again 問(wèn)題

    Git 解決 Permission denied, please try again 問(wèn)題

    git pull 在上傳項(xiàng)目的時(shí)候出現(xiàn) git@xxx password: 讓你輸入密碼,你發(fā)現(xiàn)無(wú)論輸入什么都會(huì)出現(xiàn)Permission denied, please try again問(wèn)題,其實(shí)這個(gè)主要是工程的SSH key沒(méi)有加入到你的gitlab賬戶下 1、檢查SSH Key存在 如果存在id_rsa.pub 或 id_dsa.pub 文件,跳過(guò)此步。 2、創(chuàng)建SSH Key 創(chuàng)建ssh key時(shí)會(huì)提

    2024年02月15日
    瀏覽(22)
  • Git解決Permission denied, please try again問(wèn)題

    在gitlab上傳項(xiàng)目的時(shí)候出現(xiàn)Permission denied, please try again問(wèn)題。 在使用git克隆或上傳項(xiàng)目的時(shí)候出現(xiàn) git@xxx password: 讓你輸入密碼,你發(fā)現(xiàn)無(wú)論輸入什么都會(huì)出現(xiàn)Permission denied, please try again問(wèn)題,其實(shí)這個(gè)主要是工程的SSH key沒(méi)有加入到你的gitlab賬戶下。 在git中輸入cd ~/.ssh/ 回車

    2024年02月10日
    瀏覽(24)
  • git報(bào)錯(cuò):git Permission denied, please try again.

    git報(bào)錯(cuò):git Permission denied, please try again.

    git clone/pull代碼時(shí)提示輸入密碼,密碼輸入正確但是報(bào)錯(cuò): git Permission denied, please try again. step1 檢查SSH Key是否存在 step2 獲取SSH Key 如果存在id_rsa.pub 或 id_dsa.pub 文件,跳過(guò)此步。 如果不存在,則生成: 先查看git郵箱地址 再生成SSH Key step3 將公鑰復(fù)制到git頁(yè)面profile setting SSHK

    2024年02月05日
    瀏覽(22)
  • windows配置openssh,以及密碼正確時(shí)Permission denied, please try again

    windows配置openssh,以及密碼正確時(shí)Permission denied, please try again

    最近在搭建jenkins 環(huán)境管理項(xiàng)目 需要用到ssh。而服務(wù)器目前只有一臺(tái)windows可以使用..... 首先去到官網(wǎng)去下載,至于我為什么去官網(wǎng)下載.....因?yàn)橛龅搅瞬糠謫?wèn)題,win10里面就可以直接下載 ? 但是我從官網(wǎng)下載安裝到了e盤,因?yàn)閛pensshsshd.config文件用win10安裝的話是只讀不可修改

    2023年04月20日
    瀏覽(23)
  • github 配置了公鑰依舊提示git@github.com‘s password: Permission denied, please try again

    在github上添加密鑰后 輸出如下 在 HTTPS 端口使用 SSH 有時(shí),防火墻會(huì)完全拒絕允許 SSH 連接。 如果無(wú)法選擇使用具有憑據(jù)緩存的 HTTPS 克隆,可以嘗試使用通過(guò) HTTPS 端口建立的 SSH 連接克隆。 大多數(shù)防火墻規(guī)則應(yīng)允許此操作,但代理服務(wù)器可能會(huì)干擾 如果這樣有效,萬(wàn)事大吉

    2024年02月15日
    瀏覽(24)
  • ?。?!已解決: Linux操作系統(tǒng)登錄,輸入正確賬號(hào)密碼顯示卻顯示:Sorry, that didn‘t work. Please try again.

    !??!已解決: Linux操作系統(tǒng)登錄,輸入正確賬號(hào)密碼顯示卻顯示:Sorry, that didn‘t work. Please try again.

    先給大家復(fù)現(xiàn)一下我的問(wèn)題: 為什么出現(xiàn)這個(gè)問(wèn)題??? 后來(lái)我找到了原因: 解決方案: 【補(bǔ)充:】 下面展示一些 內(nèi)聯(lián)代碼片 。

    2024年02月12日
    瀏覽(18)
  • Read timed out Please check your internet connection and try again

    java 對(duì)接 stripe 海外支付,報(bào)錯(cuò)信息如下 IOException during API request to Stripe (https://api.stripe.com): Read timed out Please check your internet connection and try again. If this problem persists,you should check Stripe\\\'s service status at https://twitter.com/stripestatus, or let us know at support@stripe.com. 這個(gè)錯(cuò)誤通常表示?API 請(qǐng)

    2023年04月11日
    瀏覽(16)
  • 已解決Error: A JNI error has occurred, please check your installation and try again

    已解決Error: A JNI error has occurred, please check your installation and try again Error: A JNI error has occurred, please check your installation and try again 這個(gè)錯(cuò)誤通常表示Java Native Interface (JNI)的安裝出現(xiàn)了問(wèn)題。 下滑查看解決方法 以下是解決該錯(cuò)誤的一些可能方法: 檢查Java環(huán)境變量:確保正確設(shè)置了

    2024年02月06日
    瀏覽(30)
  • Pycharm 安裝 github copilot 報(bào)錯(cuò):failed to initiate the github login process please try again

    Pycharm 安裝 github copilot 報(bào)錯(cuò):failed to initiate the github login process please try again

    下載安裝好copilot插件后,提示failed to initiate the github login process please try again 就非常的emo。。。 ? ? 我的pycharm是2021.1版本,在setting中安裝最新版copilot1.1.35.2063(我這兩個(gè)版本親測(cè)可使用) 之前有教程說(shuō),可以去copilot官網(wǎng)降低copilot版本,解決這個(gè)報(bào)錯(cuò)問(wèn)題。但是,若降低版

    2024年02月02日
    瀏覽(34)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包