天天看點

谷歌雲伺服器開啟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