更新时间:2022-06-18 10:13:20
默认情况下,在新创建的 Linux 计算引擎上禁用使用密码(而不是密钥)的 SSH 登录.幸运的是,它可以很快启用.
By default, SSH login using a password (as opposed to keys) is disabled on newly created Linux Compute Engines. Fortunately, it can be enabled pretty quickly.
登录到 Linux 环境,然后编辑在以下位置找到的文本文件:
Login to the Linux environment and then edit the text file found at:
/etc/ssh/sshd_config
查找以下行:
PasswordAuthentication no
并将其更改为
PasswordAuthentication yes
保存文件.
最后,使用以下命令重启 SSH:
Finally, restart SSH using:
sudo service ssh restart
此时,您现在可以使用用户 ID/密码对使用 SSH 登录.
要为 $USER
设置密码,请执行以下操作:
At this point, you will now be able to login using SSH using a userid/password pair.
To set the password for $USER
, do:
sudo passwd $USER
参考文献: