1607619556-776f505b3e0f5b4
1.1.切换到root角色
sudo -i

passwd 命令输入后修改你的新密码

1.2.修改SSH配置文件/etc/ssh/sshd_config
vi /etc/ssh/sshd_config
按键盘"i"进入修改文件
修改PermitRootLogin和PasswordAuthentication为yes

# Authentication:
PermitRootLogin yes //默认为no,需要开启root用户访问改为yes

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes //默认为no,改为yes开启密码登陆

ESC后:wq 保存
1.3.给root用户设置密码
passwd root

1.4.重启SSH服务使修改生效 reboot
/etc/init.d/ssh restart

1.5.登录
在xshell中,直接使用root账号密码登录。

2.新建普通用户登入
2.1. 本地用xshell生成密秘钥

1607619556-08bddfce8aece78
2.2. 将秘钥配置到谷歌云上
菜单 — 计算引擎 — 元数据 — SSH秘钥 — 修改 — 添加一项
1607619557-716c35505dec26b
1607619558-8bc8d7ce0bfce99

粘贴刚才从xshell复制的秘钥。在末尾添加 [空格][用户名] 这里就是“ google”,保存即可。

2.3. 用xshell连接
1607619558-dd50fe30eddf9db