谷歌GCE开启root与密码登录

GCE安全性没得说,不错,学习一下用root和密码登录

在ssh以非root用户进入后,

sudo su - root

进入root账户。然后passwd root设置root密码。

修改SSH配置文件/etc/ssh/sshd_config

 nano /etc/ssh/sshd_config

找到PermitRootLogin和PasswordAuthentication

# Authentication:
LoginGraceTime 120
PermitRootLogin yes //默认为no,需要开启root用户访问改为yes
StrictModes yes

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes //默认为no,改为yes开启密码登陆

重启SSH服务使修改生效

/etc/init.d/ssh restart