To run sudo
without a password prompt on CentOS Linux, you can edit the /etc/sudoers
file. Here’s the process:
- Open the
/etc/sudoers
file using thevisudo
command:
sudo visudo
- Add the following line at the end of the file, replacing
username
with the name of the user who should not be prompted for a password:
username ALL=(ALL) NOPASSWD:ALL
- Save and exit the file.
- Test the change by running a
sudo
command as the specified user:
sudo ls -l
Note: This change is a security risk because it allows the specified user to run any sudo
command without a password. Be sure to only grant this privilege to trusted users.