GCP谷歌云 开启SSH密码登陆权限+root密码设置

搬瓦工机场JMS

一、开启SSH权限

①方法一

1.修改SSH配置文件/etc/ssh/sshd_config
vi /etc/ssh/sshd_config 2.然后再输”i”进入编辑模式 i 3.找到以下内容并修改 PermitRootLogin yes //默认为no,需要开启root用户访问改为yes PasswordAuthentication yes //默认为no,改为yes开启密码登陆

4.修改完成后,再下按 esc 键,然后再输入
:wq

5.重启SSH服务
service sshd restart

②方法二

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
重启服务器
reboot

二、设置root密码

1.先选择从浏览器打开ssh连接服务器
LINUX | 谷歌云开启SSH及设置root密码

2.切换到root账号
sudo -i
3.设置root密码
passwd
然后会要求输入新密码,然后再重复一次密码,输入密码的时候不会显示出来,所以直接输入密码,然后回车,再然后重复输入密码回车

未经允许不得转载:搬瓦工VPS_美国VPS » GCP谷歌云 开启SSH密码登陆权限+root密码设置

赞 (6) 打赏

相关推荐

    暂无内容!

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏