root 进入ssh 出现问题

用root输入下面命令,一直让输入密码,并提示错误

ssh localhost

那是因为系统默认禁止root用户登录ssh

首先,Ctrl+C退出密码输入界面:然后输入:su -

然后,编辑sshd_config文件,输入:vim /etc/ssh/sshd_config

往下拖拖,找到如下行数,并进行修改,允许root登录ssh:

#Authentication:
LoginGraceTime 120
PermitRootLogin withoutpassword  
StrictModes yes

修改为:

#Authentication:
LoginGraceTime 120
#PermitRootLogin without-password
PermitRootLogin yes
StrictModes yes

然后,按Esc,然后输入:wq!,保存退出。

接下来,重启ssh服务,输入:/etc/init.d/ssh restart

再输入:ssh localhost

即可。

发布了34 篇原创文章 · 获赞 52 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_43157273/article/details/88029923