From 99e7b73e583f61b97b9b082e61cb44e18da8bb3e Mon Sep 17 00:00:00 2001 From: proxysu <61810006+proxysu@users.noreply.github.com> Date: Tue, 16 Jun 2020 19:30:11 +0800 Subject: [PATCH] =?UTF-8?q?Updated=20=E8=B0=B7=E6=AD=8C=E4=BA=91=E5=BC=80?= =?UTF-8?q?=E5=90=AFroot=E8=B4=A6=E6=88=B7=E4=B8=8E=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E7=99=BB=E5=BD=95=20(markdown)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 谷歌云开启root账户与密码登录.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/谷歌云开启root账户与密码登录.md b/谷歌云开启root账户与密码登录.md index 99297fb..c7853d3 100644 --- a/谷歌云开启root账户与密码登录.md +++ b/谷歌云开启root账户与密码登录.md @@ -4,24 +4,25 @@ 如下图所示,选择红线标示的项,中文界面,选择对应位置。 ![](https://github.com/proxysu/Resources/raw/master/image/googlevpsroot2.png) 在打开的网页版ssh登录界面,依次输入以下命令: -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/PermitRootLogin /#PermitRootLogin /g' /etc/ssh/sshd_config` -sudo sed -i 's/PermitEmptyPasswords /#PermitEmptyPasswords /g' /etc/ssh/sshd_config +`sudo sed -i 's/PasswordAuthentication /#PasswordAuthentication /g' /etc/ssh/sshd_config` -sudo echo "PermitRootLogin yes" >> /etc/ssh/sshd_config +`sudo sed -i 's/PermitEmptyPasswords /#PermitEmptyPasswords /g' /etc/ssh/sshd_config` -sudo echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config +`sudo echo "PermitRootLogin yes" >> /etc/ssh/sshd_config` -sudo "PermitEmptyPasswords no" >> /etc/ssh/sshd_config +`sudo echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config` -sudo systemctl restart sshd +`sudo "PermitEmptyPasswords no" >> /etc/ssh/sshd_config` + +`sudo systemctl restart sshd` 生成随机密码: -cat /dev/urandom | tr -dc '_A-Z#\-+=a-z(0-9%^>)]{<|' | head -c 20 ; echo '' +`cat /dev/urandom | tr -dc '_A-Z#\-+=a-z(0-9%^>)]{<|' | head -c 20 ; echo ''` -sudo passwd root +`sudo passwd root` 输入两次上面生成的随机密码,这个随机密码要保存好。这个就是登录root账户的密码。 \ No newline at end of file