sudo allows a system administrator to grant certain users (or groups) a permission to run privileged commands on Linux system. In order to run a command with sudo, users have to type their own password at a password prompt.
To allow a specific user to use sudo without a password, use visudo command to edit sudo configuration as follows. I assume that the user name for whom you want to disable password prompt is "alice".
alice ALL=(ALL) NOPASSWD: ALL
Ctrl-X to leave, save your changes, and you're done. This setting will disable a password prompt for alice when she runs any command in sudo.
To allow a user to use sudo passwordlessly for specific commands only (e.g., /usr/sbin/tcpdump and /sbin/reboot), do the following.
alice ALL=(ALL) NOPASSWD: /usr/sbin/tcpdump, /sbin/reboot
To allow all members of a specific group (e.g., alice_group) to use sudo without a password, run the following.
%alice_group ALL=(ALL) NOPASSWD: ALL
To allow all members of a group to use sudo passwordlessly for specific commands only (e.g., /etc/init.d/apache2), run the following.
%alice_group ALL=(ALL) NOPASSWD: /etc/init.d/apache2
Subscribe to Ask Xmodulo
Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!