I am using AWS Linux AMI2, I added ec2-user ALL=(ALL) ALL
and saved the file.
Now when I run any command with sudo
it displays [sudo] password for ec2-user:
How to reset this file?
I am using AWS Linux AMI2, I added ec2-user ALL=(ALL) ALL
and saved the file.
Now when I run any command with sudo
it displays [sudo] password for ec2-user:
How to reset this file?
Just remove that line.
If the problem is that you don't know the password for ec2-user
, then you must find some other way to get root access.
The line ec2-user ALL=(ALL) ALL
means that sudo
will ask for a password, because you didn't specify NOPASSWD
.
By default, sudo requires that a user authenticate him or herself before running a command.
This behavior can be modified via the NOPASSWD tag.
For a single user, try
USERNAME ALL=(ALL:ALL) NOPASSWD:ALL
We can also modify the syntax to allow specific commands like
USERNAME ALL= NOPASSWD: /bin/kill, /bin/ls
Suoders manual has more details covering this topic