谷歌云开启Root密码登陆

方法一:
1:创建谷歌云实例然后点击SSH连接VM实例.

2:输入以下命令获取Root权限:

sudo -i

3:编辑sshd_config文件,输入

vi /etc/ssh/sshd_config

然后修改以下两项参数:
3.1 修改PermitRootLogin,将no改为为yes;
3.2 修改passwordAuthentication,将no改为yes
注:要输入i变成insert状态才可编辑;修改好后输入键盘ESC,然后输入:wq完成。
4:确认修改结果

cat /etc/ssh/sshd_config

5:设置Root登陆密码
输入

passwd root

6:重启sshd服务

service sshd restart

7:接下来你就可以用winscp/Putty/xshell利用root和密码进行连接谷歌云了

方法二:
CentOS和Debian利用以下命令开启:

sed -i ‘s/PermitRootLogin no/PermitRootLogin yes/g’ /etc/ssh/sshd_config
sed -i ‘s/PasswordAuthentication no/PasswordAuthentication yes/g’ /etc/ssh/sshd_config

Ubuntu系统采用以下命令:

sed -i ‘s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g’ /etc/ssh/sshd_config
sed -i ‘s/PasswordAuthentication no/PasswordAuthentication yes/g’ /etc/ssh/sshd_config

然后
2.2:设置Root登陆密码
输入

passwd root

2.3:重启sshd服务

service sshd restart

利用reboot重启VM实例即可.

发表回复

您的电子邮箱地址不会被公开。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据