Arjun Agarwal
Arjun Agarwal

Reputation: 1

Amazon Linux 2 User Creation with SSH Keys

I am trying to create some users with Amazon Linux 2 using adduser command but not able to create ssh files for login for those users.

If someone can help me out with the steps it would be really helpful

Upvotes: 0

Views: 703

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269274

This is standard Linux. It is actually unrelated to the fact that you are using an Amazon EC2 instance.

In a typical organisation, users should generate their own keypairs and then provide the public half to the SysAdmins so they can put it in the ~/.ssh/authorized_keys file. This way, even the SysAdmins don't have the private half of the keypair.

See: How to use ssh-keygen to generate a new SSH key

Alternatively, users can generate a keypair in the Amazon EC2 console. The public keypair will be retained by AWS for launching future instances and the private keypair will be provided as a downloaded .pem file.

They can extract the public key from a private key with:

ssh-keygen -y -f key.pem > key.pub

See: Use RSA private key to generate public key?

Upvotes: 1

Related Questions