我启动了一个 AWS EC2 实例。我可以使用 Amazon 生成的 SSH 私钥以用户 ec2-user 连接到我的实例。
我按照以下说明操作:http : //docs.aws.amazon.com/AWSEC2/latest/UserGuide/managing-users.html为新用户“bob”添加凭证。
我创建了一个新用户 bob,并使用 PuTTY Key Generator 生成了一个新的公钥+私钥集。我将公钥移动到我的 EC2 实例 /home/bob/.ssh/authorized_keys
我将 /home/bob/.ssh 和 /home/bob/.ssh/authorized_keys 的所有者和组更改为 bob:bob
我将 /home/bob/.ssh 的权限改为 700
我将 /home/bob/.ssh/authorized_keys 的权限改为 600
当我尝试以 bob 的身份通过 SSH 连接到我的 EC2 实例时,使用 bob 的私钥,我出现了错误:
PuTTY Fatal Error
Disconnected: No supported authentication methods available (server sent: pulickey,gssapi-keyex,gssapi-with-mic)
Run Code Online (Sandbox Code Playgroud)
PuTTY 控制台显示:
Using username "bob".
Server refused our key
Run Code Online (Sandbox Code Playgroud)
我还尝试从命令行使用 bob 的私钥 ssh 进入我的 EC2 实例,但没有成功。它不接受密钥的密码。我还尝试使用没有密码短语的密钥对,但仍然提示我输入密码并且无法访问服务器。
这是我非常详细的输出
$ ssh -vvv -i …Run Code Online (Sandbox Code Playgroud) ssh putty amazon-web-services amazon-ec2 redhat-enterprise-linux