FILEEM

POWER OF DREAM

将GCP设置为root账号密码模式SSH登陆

在上一篇教程中,我介绍了如何用electerm等第三方SSH工具登陆谷歌云GCP,采用的是私钥登录方式:https://fileem.com/login-gcp-terminal-with-third-party-ssh-tools-such-as-electerm

但今天配置桌面远程登录,需要用到账号密码模式登陆,所以在此补充一下如何GCP设置为账号密码模式SSH登陆。

《将GCP设置为root账号密码模式SSH登陆》

  1. 网页上”在浏览器窗口中打开”GCP终端,打开浏览器版的终端。这时候默认登录账户是你的帐户名,先用sudo -i切换到root账户;

  2. 输入passwd,设置root的密码;

root@tw:~# passwd
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
  1. 使用nano /etc/ssh/sshd_config 编辑服务器配置文件,找到以下两个参数,改为 yes
    《将GCP设置为root账号密码模式SSH登陆》
    《将GCP设置为root账号密码模式SSH登陆》
PermitRootLogin yes
PasswordAuthentication yes

nano 使用 ctrl + oenter保存,ctrl + x退出编辑。

  1. 使用 systemctl restart sshd.service 重启SSHD服务。

下面就可以愉快的用账号密码连接GCP了。

点赞