简体   繁体   English

AWS:为我的用户添加 SSH 密钥

[英]AWS: Adding SSH keys for my user

I just created an instance on AWS EC2.我刚刚在 AWS EC2 上创建了一个实例。 I got the ec2-user's pub/private keys and I'm able to login using my puTTY client from my Windows machine.我获得了 ec2-user 的 pub/private 密钥,并且可以使用我的 puTTY 客户端从我的 Windows 机器登录。

Now, I want to connect to the same instance with a new user(xxxx).现在,我想使用新用户(xxxx)连接到同一个实例。 For that:为了那个原因:

  • First I created a user using 'useradd' on AWS instance首先,我在 AWS 实例上使用“useradd”创建了一个用户
  • Generated pub/private keys on my windows machine using puTTYgen使用 puTTYgen 在我的 Windows 机器上生成公钥/私钥
  • Copied pub key content to >> /root/.ssh/authorized_keys file.将发布密钥内容复制到 >> /root/.ssh/authorized_keys 文件。
  • Now, I'm trying to connect using puTTY by using the private key现在,我正在尝试通过使用私钥使用 puTTY 进行连接

But I'm unable to login, and I'm getting the following error:但是我无法登录,并且出现以下错误:

Authentication log (see session log for details):
Using username "xxxx".
Server refused our key
No supported authentication methods left to try!

Connection has been unexpectedly closed. Server sent command exit status 0.

我可以通过在 xxxx 用户主目录( /home/xxxx/.ssh/authorized_keys )而不是/root/.ssh/authorized_keys下创建一个 authorized_keys 文件来解决这个问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM