Ubuntu 16.04 为 root 帐号开启 SSH 登录

1、安装 open ssh:

sudo apt-get install openssh-server

修改 root 密码

sudo passwd root

2. 以其他账户登录,通过 sudo nano 修改 /etc/ssh/sshd_config :

xxx@ubuntu:~$ su - root   #切换到root账户

Password:                           #输入第二步修改的root密码

root@ubuntu:~# vi /etc/ssh/sshd_config

3、 修改sshd_config为:

# Authentication: 

LoginGraceTime 120 

#PermitRootLogin prohibit-password

PermitRootLogin yes 

StrictModes yes

4. 重启 ssh 服务

root@ubuntu:~# sudo service ssh restart 

root@ubuntu:~#