为Ubuntu Server开启SSH

虚拟机安装的Ubuntu Server镜像,向导里需要设置用户账号,没有设置root密码.

1.登陆初始账号,修改root 密码
sudo passwd root

su切换root 试试

2.root 账号下修改配置文件
vi /etc/ssh/sshd_config
找到下面相关配置:

# Authentication:
LoginGraceTime 120
PermitRootLogin prohibit-password
StrictModes yes

更改为:

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

3.重启ssh
sudo service ssh restart