当前位置:首页 > Linux vps > 正文

谷歌云Root密码登陆开启设置

许本聪 Linux vps 2873阅读

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

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

1
sudo -i

3:编辑sshd_config文件,输入

1
vi /etc/ssh/sshd_config

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

1
cat /etc/ssh/sshd_config

5:设置Root登陆密码
输入

1
passwd root

6:重启sshd服务

1
service sshd restart

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

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

1
2
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系统采用以下命令:

1
2
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登陆密码
输入

1
passwd root

2.3:重启sshd服务

1
service sshd restart

利用reboot重启VM实例即可.


版权声明:本文由 @许本聪 发布在 老许Blog,转载请注明出处!

更新时间 2022-02-21

有话要说...

搜索

最新文章

最新留言