天天看点

谷歌云服务器开启root登录

1: 使用网页ssh登录谷歌服务器,切换到root用户。

命令:sudo -i

[chiuci2016@instance-3 ~]$ sudo -i

2: 修改ssh配置文件

[root@instance-3]# vim /etc/ssh/sshd_config

修改下面两个参数把no改为yes

PermitRootLogin no

PasswordAuthentication no

#Port 22 ###修改sshd端口号,将前面的#号去掉,修改22为其他没有使用的端口,建议修改为1000以上。

3: 给root账户添加密码

命令:passwd root 或 echo “xxxxx” |passwd --stdin root

### xxxx为密码

4: 重启ssh服务使修改生效

centos命令:service sshd restart