SSH服务拒绝远程连接

使用远程连接工具时出现ssh服务器拒绝密码。

解决方案一:

CentOS和Debian通用,输入以下两条命令

sed -i 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config

Ubuntu系统,输入以下两条命令

sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config

重启ssh服务

sudo service ssh restart

连接成功

解决方案二:

编辑配置文件

sudo vim /etc/ssh/sshd_config

修改配置文件,找到Authentication所在位置,修改成如下所示

LoginGraceTime 2m          #登陆时间
 
PermitRootLogin yes        #允许root登录
 
StrictModes yes            #严格模式
 
PasswordAuthentication yes #密码验证(没有,需要另行添加)

重启ssh服务

sudo service ssh restart

连接成功

© 版权声明
THE END
喜欢就支持一下吧!
点赞45 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容