1、使用gcp自带的浏览器shell登录vm实例
2、首先切换用户为root用户
sudo -i
3、为root用户设置密码
passwd root
输入两次root用户密码
Enter new UNIX password:
Retype new UNIX password:
控制台会提示设置成功
4、修改配置文件
vim /etc/ssh/sshd_config
需要修改的配置项目如下,在32行和56行:
PermitRootLogin yes
PasswordAuthentication yes
若使用centos则执行
vim /etc/ssh/sshd_config
修改
PermitRootLogin yes
PasswordAuthentication yes
保存并退出vim
执行重启服务器的操作
reboot
即可生效,并且无需再执行/etc/init.d/ssh restart这个命令
5、重启服务
/etc/init.d/ssh restart
6、打开shell软件客户端
填写ip地址
之后输入用户名和密码就可以了
原文链接:https://blog.csdn.net/qq_41698979/article/details/88808096