google云服务ssh的开启

一、设置root密码

1. 从浏览器打开ssh连接服务器
2.切换root账户

sudo -i

3.设置root密码

passwd
需要输入两次密码,并且密码不会显示出来,输入后直接回车即可

二、开启SSH权限

1.方式一

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

重启SSH服务

/etc/init.d/ssh restart

2.方式二

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服务

/etc/init.d/ssh restart

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值