PasswordAuthentication(passwordAuthentication yes)

http://www.itjxue.com  2023-02-18 10:26  来源:未知  点击次数: 

远程SSH连接linux Password authentication failed

我也遇到这种情况,ssh服务那些都很正常,最后原因是selinux导致的,执行setenforce 0,临时关闭selinux就可以了

UsernamePasswordAuthenticationToken

UsernamePasswordAuthenticationToken继承AbstractAuthenticationToken实现Authentication

所以当在页面中输入用户名和密码之后首先会进入到UsernamePasswordAuthenticationToken验证(Authentication),

然后生成的Authentication会被交由AuthenticationManager来进行管理

而AuthenticationManager管理一系列的AuthenticationProvider,

而每一个Provider都会通UserDetailsService和UserDetail来返回一个

以UsernamePasswordAuthenticationToken实现的带用户名和密码以及权限的Authentication

password authentication是什么意思

password authentication

口令认证

双语对照

词典结果:

网络释义

1. 密码验证

2. 口令认证

例句:

1.

Currently, the staging and process controls are regulated through user name and password authentication.

win10 远程登录Ubuntu 18.04错误

#ps -e|grep ssh

运行后如果有结果显示就说明ssh服务开启,如果没有结果,运行:

service sshd start

或者service ssh start

如果系统提示unreconize service

#apt install openssh-client

#apt install openssh-server

安装以上deb包以后#service sshd/ssh start

启动服务以后远程未必能直接ssh ,需要修改sshd_config文件把默认passwordauthentication设置为yes(因为win10:ubuntu默认no)

以下为配置步骤,请参考:

刚解决此问题,纠结了一段时间,现给你解答:

#cd /etc/ssh/

#vim sshd_config

修改如下:

#PasswordAuthentication no

改为:

PasswordAuthentication yes

(注意前面的 # 去掉)

【保存】文件后记得:service ssh restart

(只有重启服务才能让配置生效嘛,hahahia)

课后问题总结:

遇到此问题由于对ssh配置不熟悉,一度以为是:防火墙、服务企停、ssh/sshd安装包等等bug导致,经历一系列lab后,把/etc/ssh/sshd_config文件与正常的ubuntu配置文件比对后发现问题根源(原来就是win10:ubuntu

虚机默认密码认证是【关闭】状态),通过开启此配置解决问题。

我在CentOS6.5中设置了 PasswordAuthentication no但是不使用密钥 ,利用用户名和密码仍可以登录

如果你使用密钥登陆不上,需要注意权限:

1).ssh目录是700权限;

2)authorized_keys公钥是400权限

3)用ssh连接用的私钥是600权限

你的情况不是这样的,你确定PasswordAuthentication设置成no了吗? 如果确定设置好了,你重启下电脑看看,我以前试过,PasswordAuthentication设置成no后,密码是不能登陆的。

(责任编辑:IT教学网)

更多

相关其他WEB语言文章

推荐其他WEB语言文章