Create user on AWS ec2 instance Linux

Create user on AWS ec2 instance Linux

Create user on AWS ec2 instance Linux

Create a user for providing access to other developer or use for virtual host in linux. It will also use for providing limited access for user like only read access, read or write access etc.

$sudo adduser aman

It will ask for new password for the user aman.
Note: this password is used to login password for the user when you are using terminal.

Granting permission for user aman

$sudo visudo

Add below mentioned line in the file

#User privilege for aman

And press CTRL+X for exit, it will ask for save modified changes, Y for the saving modified file.

Creating user authorisation to the sever with public key.

$su aman
$cd home/aman
$ssh-keygen -b 1024 -f aman -t dsa
$mkdir .ssh
$chmod 700 .ssh
$cat > .ssh/authorized_keys
$chmod 600 .ssh/authorized_keys
$sudo chown aman:ubuntu .ssh
$sudo chown aman:ubuntu .ssh/authorized_keys

Note: In above step aman is user and ubuntu is the defult user group.

Now you need to download the key “aman” and use it for connecting ssh or sftp.