允许root登录

  • A+
所属分类:Linux

1.允许root登录

vi /etc/ssh/sshd_config

将PermitRootLogin值改yes

允许不输入密码登录

将PermitEmptyPasswords yes前面的#号去掉

重启服务:service sshd restart(/etc/initd.d/sshd restart)

测试:ssh <ipaddress> 或 ssh <hostname> 或 用putty软件


2.使用普通用户登录Ubuntu系统,打开命令行窗口

更改root用户密码,命令:sudo passwd root

首先输入当前用户的密码

然后输入root账户的密码

确认root用户的密码

编辑ssh的配置文件,命令:nano /etc/ssh/sshd_config

在Authentication部分,注释掉“PermitRootLogin without-password”

在Authentication部分,添加“PermitRootLogin yes”

使用“Ctrl+o”保存数据,使用“Ctrl+X”退出编辑器

重新启动ssh服务,命令:sudo service ssh restart

然后就可以使用root帐号登录ssh


3.解决办法如下:
默认的情况下 /etc/ssh/sshd_config 是一个 全部注释得文件 去掉注释 PermitRootLogin  yes  就可以 用 root 登陆了:)
如果有需要可以通过/etc/init.d/sshd重起sshd程序!


4.

解决方法:

1) 普通用户登录,然后su root切换到root账号,

2) vim /etc/ssh/sshd_config

3. 注释掉 #PermitRootLogin without-password,添加 PermitRootLogin yes

# Authentication:
LoginGraceTime 120
#PermitRootLogin without-password
PermitRootLogin yes
StrictModes yes
4. 重启 ssh  服务
root@ubuntu14:~# sudo service ssh restart
ssh stop/waiting
ssh start/running, process 1499
root@ubuntu14:~#

 

发表评论

您必须登录才能发表评论!