0% found this document useful (0 votes)
17 views20 pages

Creating Users To Use Pem Key and Password On Linux

The document describes how to create users that can log in to an EC2 instance using the same key pair and password. It involves generating a key pair, creating users, adding the public key to each user's authorized_keys file, and configuring password authentication for logins.

Uploaded by

akalugwueze
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views20 pages

Creating Users To Use Pem Key and Password On Linux

The document describes how to create users that can log in to an EC2 instance using the same key pair and password. It involves generating a key pair, creating users, adding the public key to each user's authorized_keys file, and configuring password authentication for logins.

Uploaded by

akalugwueze
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Lab: How to create users and add them to use same key pair and password.

Creating Users to use same key pair.

1) Create a key pair to use for the users.

Click on Create key to create a new one.

But for this lab, we will use the key pair that has been created already, KeyPair.
2) Generate .ppk file using the pem key you created for Linux instances.
Launch PuttyGen to do that.
Click on Load to load .pem keypair created.

Select the file type as all (*).


Select KeyPair.pem
Click Save private key.
I named the file as KeyPair, click save.
My KeyPair.ppk has been created.

3) Logon as ec2-user following the below steps.

Copy the public IP address and the username.


- 54.161.61.27
- ec2-user
Goto putty:

Expand SSH > Auth


Click on Credentials

Browse Private key pair for authentication to select the KeyPair.ppk you generated above.
4) Create a new User, the user created will use the same keypair generated to logon to the
same instance.

User “Nendir” is created using the below command:

sudo useradd Nendir

Switch to the newly created user (Nendir):

sudo su – Nendir

Observed user has been switched from ec2-user to Nendir


Make directory .ssh and created w file inside .ssh as authorized_keys.
Goto PuttyGen to generate keypair using the .pem key pair created earlier (KeyPair.pem).
I copied all the content to paste it in the authorized_keys file created in .ssh.

ssh-rsa
AAAAB3NzaC1yc2EAAAADAQABAAABAQCwLxHaaBR+v5tBsNUbPHnU3F1mW8+JGbLVfwF+W
udPf3HorNPkoe9BCW76TuzybhD7FHgREjT3ehU0AS3gjRwuMGbD0jDIPaHqkd+hpc4CIlTu89w
sasiQSSS3P5c43TgyiZJKhlu7uJACABnj6IUimiQReoMD89BhPhEtgurzQt8OhEEFDXQrYWULt4I5
2+B+CINZfzKe0CsndjkvG7q1zAffNiWxPidP116AkhdurW2sAn1WFgR21xEblC6hWW/XT/tOYm
MSUJ4AivvCCXF88+409R36aaEcAsIgSkuB3JQWQZADnR1T/FJD6PlhgNIFfkgaxd1ZNGxbd4uyMr
iT imported-openssh-key
Save the file.

:wq

Next, goto Putty to Logon to the Server using the new user created (Nendir)
Click on Credentials to add the key pair
Logon Successfully.

You can follow the same process to created users to be using different Key Pairs. You have to
then create key pair for each user differentially using the steps highlighted above for creating
key pairs.
Next: Creating users to logon using Password not Key pairs this time.

1) Logon to the Instance on Putty using the steps highlighted above.

2)
3)

Password is set to: !AbcdeF123//@31

4) sudo vim /etc/ssh/sshd_config


To change PasswordAuthentication from no to yes.
Save the file.

5) Restart sshd service using the below command:


Service sshd restart
Users can now logon with password created.

Exercise: Learn how to create users on Windows Instances.

You might also like