sudo - How to use sudoers for python's script - Ask Ubuntu


i had script (named script) in bash, , wanted allow user (named "userscript") run root without giving password.

so, edited file /etc/sudoers , added 2 lines @ end :

cmnd_alias script=/home/userscript/desktop/script  userscript all:nopasswd: script 

(the script in desktop symbolic link prevent modification)

it worked well. after days, script big, rewrote in python, multiples files, classes...

so, changed nothing except symbolic link's target, when try run script, terminal ask password, , give me error (sorry if it's not message, ubuntu isn't in english)

sorry, user userscript isn't allowed execute "/usr/bin/python script" root on name_of_my_computer

i run script user "userscript" :

sudo python script 

your problem here command try run sudo python; script first argument python. instead , script should has executable permissions, , you're supposed run sudo script_name.

second, when python script_name , won't script, wherever it's stored. either have give full path, or again, have script live in 1 of directories listed in path variable.


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User