Tuesday, May 25, 2021

Linux User Creation With SSHKeypairs on AWS

 In order create user account linux server with ssh keypair for login server with putty tool.

Follow the below steps:

Step 1: Login to Linux server where you want to create user account.

Step 2: create user accouunt by using below command

    useradd -m -s /bin/bash <user name>

Step 3: To check whether user account created

cat /etc/passwd

Step 4: Switch into created user

su - <user name>

Step 5: create .ssh directory under user's home folder

/home/<user name>/  mkdir .ssh

Step 6: change the .ssh directory permission and navigate to that directory

  chmod 700 .ssh

cd .ssh

step 7: under the user's home folder in .ssh directory.  need to generate keypair 

ssh-keygen

step 8: It will generate two files

id_rsa    ----> this private key of user

id_rsa.pub ----> this is the public key user

step 9: create a file called authorized_keys and copy the content of from id_rsa to authorized_keys file

       cp id_rsa.pub authorized_keys

step 10: change the permission of authorized_keys

chmod 600 authorized_keys

step 11: copy the id_rsa file content to vdc server and open and notepate paste the content and save the file with pem extentio "filename.pem"

step 12: open puttygen tool and load the pem file and save as the private key.  it will prompting to save your file.  now your pem file is converted into ppk file

step 13: try to login with this ppk file for specified linux server

No comments:

Post a Comment