First, open sudoers using visudo:
sudo visudo
Then add the following line to the bottom of the file:
<user> ALL=NOPASSWD: <absolute_path_to_script_file>
Where <user> is the user running the script, and <absolute_path_to_script_file> is...self explanatory :). Though I've found that the script needs to be placed in /usr/bin/ to for the entry in sudoers to be effective.
Save the changes to the file, and log in and out to enact the change. Now, when you sudo script, there will be no prompt for a password.
No comments:
Post a Comment
Please leave a comment if you find this blog helpful or interesting! I'd love to hear from you!