SSH登陆无权限
Posted 格格巫 MMQ!!
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SSH登陆无权限相关的知识,希望对你有一定的参考价值。
在第一版启动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,那么快跑!重建用户名,重新操作!
网上有不同用户名的登录教程,但是我看不懂,所以我选择直接重装…
以上是关于SSH登陆无权限的主要内容,如果未能解决你的问题,请参考以下文章
Linux 批量建立信任关系,实现ssh无password登陆的脚本
如何实现SHELL:用SSH批量登陆到其他服务器,每台服务器登陆密码不同