SSH登陸無權限的一種情況


萬惡的hadoop,在有老師的指導書下還出現了各種各樣的錯誤。

在第一版啟動hadoop沒有權限后,我開始了第二次嘗試。這次我為區分各台虛擬機將用戶名又初版的 wxy 改成了各自的主機名,結果在裝ssh時出現了這個錯誤

[master@master .ssh]$ ssh-copy-id -i ~/.ssh/id_rsa.pub master@slave2
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/master/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
master@slave2's password: 
Permission denied, please try again.
master@slave2's password: 
Permission denied, please try again.
master@slave2's password: 
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

一直提示 Permission denied, please try again. 盡管我密碼正確。

[master@master .ssh]$ ssh-copy-id -i ~/.ssh/id_rsa.pub master@slave2 

加粗的部分為slave2的用戶名和主機名,應該為 slave2@slave2 ,再運行命令即可

[master@master .ssh]$ ssh-copy-id -i ~/.ssh/id_rsa.pub slave2@slave2
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/master/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
slave2@slave2's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'slave2@slave2'"
and check to make sure that only the key(s) you wanted were added.

輸入密碼,成功執行。

注意 "ssh 'slave2@slave2'" ,他會提示如何用ssh連接slave2,如果你直接 ssh slave2 還是會報錯

[master@master .ssh]$ ssh slave2
master@slave2's password: 
Permission denied, please try again.
master@slave2's password: 
Permission denied, please try again.
master@slave2's password: 
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

而使用 ssh 'slave2@slave2' 則能正常免密登陸。

[master@master .ssh]$ ssh 'slave2@slave2'
Last login: Wed Oct 20 04:27:04 2021
[slave2@slave2 ~]$ ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.18.132 netmask 255.255.255.0 broadcast 192.168.18.255

經查ip確定為slave2,問題解決!

如果問題解決了,如果你在裝Hadoop,那么快跑!重建用戶名,重新操作!

網上有不同用戶名的登錄教程,但是我看不懂,所以我選擇直接重裝......

看到這篇文章的可以試一下這個辦法,不行的話就是配置文件和密碼的錯誤了,可以留言一起討論。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM