Grant sudo without typing password

In AWS EC2, you can easily find that default users like ubuntu, ec2-user don’t need to type any passphrases to enter sudo privilege. So, the question is how we can archive this features for our servers. You just follow some steps bellow to do that

Step 1: create new user in your system or using default users
Step 2: enter folder /etc/sudoers.d, create a new file like 90-cloud-init-user
Step 3: enter this line into it: <your user> ALL=(ALL) NOPASSWD:ALL
Example: ubuntu ALL=(ALL) NOPASSWD:ALL
Step 4: save this file and log in again to your system. Test it with sudo su command

See you in the next tips!

4 Likes

Nhanh và gắt, bài hướng dẫn kiểu này lại hay đấy anh =))

1 Like