Saturday, July 11, 2020

Create a New Sudo User in AWS EC2 (Ubuntu AMI)

Create a New Sudo User in AWS EC2

(Ubuntu AMI)

Log in your Ec2 Instance using “ec2-user”
ssh ec2-user@<ip> -i <ssh key>
 Log in to your server as the root user.
ubuntu@ip-172-31-24-53:~$ sudo -i
root@ip-172-31-24-53:~#
 Use the adduser command to add a new user to your system.
adduser <username>
root@ip-172-31-24-53:~# adduser test


Set and confirm the new user’s password at the prompt. Use 
strong password to secure account
root@ip-172-31-24-53:~# passwd test
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Use the usermod command to add the user to the sudo group.
usermod -aG sudo username
root@ip-172-31-24-53:~# usermod -aG sudo test
By default, on Ubuntu, members of the sudo group have sudo privileges.
Test sudo access on new user account
Use the su command to switch to the new user account.
root@ip-172-31-24-53:~# su test
su - username


As the new user, verify that you can use sudo by prepending “sudo” to the command
that you want to run with superuser privileges.
test@ip-172-31-24-53:/root$ sudo ls -la /root

1 comment:

  1. A great content material as well as a great layout.Thanks for sharing this here Amazon bellen

    ReplyDelete

Wireless Security Configuration: Protect Your Network Now!

Introduction: In today’s connected world, wireless networks are as common as smartphones, and they’re often the gateway to our personal, pr...