PDA

View Full Version : [ubuntu] Adding a script to sudoers



dmub82
May 7th, 2008, 09:42 AM
I want user "d" to be able to run a script, ~/Documents/Scripts/reconnect.sh, with sudo without entering a password (so I can schedule it to run without intervention). How do I set that up in my sudoers?

(I've got the basics of using visudo, I just can't figure out the exact syntax to do what I want.)

Xiong Chiamiov
May 7th, 2008, 09:50 AM
Is this (https://help.ubuntu.com/community/RootSudo#head-66c2db5bdb2734f0a66336d8d68499c47c82fff5) what you're looking for?

kerry_s
May 7th, 2008, 10:05 AM
I want user "d" to be able to run a script, ~/Documents/Scripts/reconnect.sh, with sudo without entering a password (so I can schedule it to run without intervention). How do I set that up in my sudoers?

(I've got the basics of using visudo, I just can't figure out the exact syntax to do what I want.)


d ALL=NOPASSWD: ~/Documents/Scripts/reconnect.sh

you might have to use full path, it would be better to put your script in /usr/local/bin

sudo cp ~/Documents/Scripts/reconnect.sh /usr/local/bin/reconnect

d ALL=NOPASSWD: /usr/local/bin/reconnect

dmub82
May 7th, 2008, 10:58 AM
d ALL=NOPASSWD: ~/Documents/Scripts/reconnect.sh

That's what I thought I was doing that didn't work, but this:


sudo cp ~/Documents/Scripts/reconnect.sh /usr/local/bin/reconnect

d ALL=NOPASSWD: /usr/local/bin/reconnect

was perfect. Thanks.