1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-23 21:56:08 +03:00
7 谷歌云开启root账户与密码登录
proxysu edited this page 2020-10-26 10:03:23 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

谷歌云默认关闭root账户远程登录也不允许使用密码登录只能用证书出于方便的目的可能需要开启root账户使用密码登录。以下为操作过程
在谷歌云操作界面使用网页ssh登录相应VPS主机如下图所示,点击图中红线圈出的倒三角图标:

如下图所示,选择红线标示的项,中文界面,选择对应位置。

在打开的网页版ssh登录界面依次输入以下命令(复制以下命令然后Ctrl+v 粘贴)

sudo sed -i 's/PermitRootLogin /#PermitRootLogin /g' /etc/ssh/sshd_config

sudo sed -i 's/PasswordAuthentication /#PasswordAuthentication /g' /etc/ssh/sshd_config

sudo sed -i 's/PermitEmptyPasswords /#PermitEmptyPasswords /g' /etc/ssh/sshd_config

echo "PermitRootLogin yes" | sudo tee -a /etc/ssh/sshd_config

echo "PasswordAuthentication yes" | sudo tee -a /etc/ssh/sshd_config

echo "PermitEmptyPasswords no" | sudo tee -a /etc/ssh/sshd_config

sudo systemctl restart sshd

生成随机密码:

cat /dev/urandom | tr -dc '_A-Z#\-+=a-z(0-9%^>)]{<|' | head -c 20 ; echo ''

sudo passwd root

输入两次上面生成的随机密码这个随机密码要保存好。这个就是登录root账户的密码。
至次可以用其他ssh客户端以root身份使用密码登录此VPS。也可以使用本项目ProsySU一键安装翻墙代理。