[实践OK]ssh免密码登录Permission denied (publickey,gssapi-keyex,gssapi-with-mic) 的解决方案!

jackxiang 2019-1-18 11:07 | |
密钥登陆能,发现SSH不行,提示:
$ssh -l xiangdong 10.244.25.**
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

到:
$ssh -l xiangdong 10.244.25.**
xiangdong@10.244.25.89's password:


实践OK办法,能密钥能密码:
cat  /etc/ssh/sshd_config|grep -E "PermitRootLogin|UsePAM|PasswordAuthentication"

UsePAM yes  #改成NO后出现需要密钥,还登陆不了。后修改为yes后重启oK service sshd restart
PermitRootLogin yes
PasswordAuthentication yes


root依然不行,修改UsePAM no,还是不行,后来加一个irdcops帐号且能 sudo ,也就用它去SSH就行了:
$ssh -l root 10.244.25.**
root@10.244.25.**'s password:
Permission denied, please try again.

==================================
首先:配置ssh服务器配置文件。

在root 用户下才能配置。

vi /etc/ssh/sshd_config

权限设为no:

#PermitRootLogin yes

#UsePAM yes

#PasswordAuthentication yes

如果前面有# 号,将#号去掉,之后将yes修改为no。

修改之后为:

PermitRootLogin no

UsePAM no

PasswordAuthentication no

权限设为yes:

RSAAuthentication yes

PubkeyAuthentication yes

(2)重启sshd服务

systemctl restart sshd.service

systemctl status sshd.service #查看ssh服务的状态

#systemctl start sshd.service  #开启ssh服务

#sytemctl enable sshd.service #ssh服务随开机启动,还有个disabled

#systemctl stop sshd.ervice #停止

正常情况下应该是Active:active(running)
摘自:https://www.cnblogs.com/xubing-613/p/6844564.html

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/10057/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2019-1-19 11:26
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]