Linux下ssh root@ip 没有权限Permission denied, please try again.

操作前先备份

cp /etc/ssh/sshd_config{,.bak}

第一种解决办法,将PermitRootLogin 的值改为yes,并保存

vim /etc/ssh/sshd_config

PermitRootLogin yes

重启sshd服务:systemctl restart sshd.service

第二种解决办法:检查启用登入有没有被限制,

查看vim /etc/ssh/sshd_config 配置文件里有没有(AllowUsers *@10.4.*.*)限制

vim /etc/ssh/sshd_config

AllowUsers  *@10.4.*.*   *@172.30.*.*

AllowUsers 后面添加你服务器的IP网段就可以

重启sshd服务:systemctl restart sshd.service

有限公司限制源地址登入服务器

scp和sync都是基于ssh服务器,受限问题,检查sshd_config配置文件是否首先

scp报Permission denied, please try again.没有权限

rsync报Permission denied, please try again.没有权限

 

以下知识可以不用看

在sshd_config中,这四个条目限制的:

AllowUsers

AllowGroups

DenyUsers

DenyGroups

摘抄:https://www.ibm.com/developerworks/cn/aix/library/au-ssh_restrict/index.html

摘抄:https://askubuntu.com/questions/497895/permission-denied-for-rootlocalhost-for-ssh-connection

技术支持QQ:350161751

posted @ 2018-09-27 10:37  随口说linux  阅读(1198)  评论(0编辑  收藏  举报