To run sudo without a password prompt on CentOS Linux, you can edit the /etc/sudoers file. Here’s the process:
- Open the
/etc/sudoersfile using thevisudocommand:
sudo visudo
- Add the following line at the end of the file, replacing
usernamewith 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
sudocommand 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.