I have been trying to specify a script that I would like to run without being prompted for a password. After a number of google and stack searches and a number of different syntax changes, I still cannot get it to work. One peculiar thing is that when typing sudo visudo
nano is opened to edit the file. I never specified nano as the editor, but I may have first edited the file with nano. Would that make nano the default editor? If so, could that cause problems. Thanks for the help.
Here is my sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:$
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL) ALL
pat ALL=NOPASSWD: /home/pat/test.sh
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
./test.sh
while in my home directory, I am prompted for a password.sudo ./test.sh
?su pat -c "...
. The problem is that script cant run with this code unless a user is there to input a password.