Google Cloud原本自带的SSH工具用着也挺不错,但是由于国内的网络环境和统一集中管理等原因,还是用SSH工具管理VPS方便一些。
我只试了一下CentOS,其他的Linux系统没有试过,不过原理应该也是一样的。
一、修改ssh配置文件并设置root密码
1.首先使用Google Cloud SSH登录VPS
2.切换到root账户
sudo-i
3.编辑ssh配置文件
vim/etc/ssh/sshd_config
4.修改以下内容即可
按键盘【i】进入编辑,按【Esc】退出编辑,再输入:wq保存并退出
5.重启ssh
service sshd restart
6.为root账户设置密码
passwd
输入密码
输入密码的时候不会显示出来,所以直接输入密码,然后回车,再然后重复输入密码回车
确认密码再输入一次
设置成功
二、用shell工具登录谷歌云实例
1.安装Finalshell连接工具
点击下载Finalshell下载完成后直接安装就好
2.打开Finalshell软件连接服务器
点击【SSH连接Linux】
输入账户和密码
双击登录
点击【接受并保存】
连接成功
拓展
可以用下面的命令改配置文件,然后改下密码,重启一下系统。
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
如若转载,请注明出处:https://www.ozabc.com/it/440332.html