Score:0

visudo don't apply modifications

us flag

i'm on ubuntu server I'm trying to use a command

sudo /usr/binsystemctl start myscript.service

Without password. i want this command execute without ask password.

I used

sudo visudo

and writed :

peon ALL =NOPASSWD: /usr/bin/systemctl restart myscript.service
peon ALL =NOPASSWD: /usr/bin/systemctl start myscript.service
peon ALL =NOPASSWD: /usb/bin/systemctl stop myscript.service
peon ALL =NOPASSWD: /usb/bin/systemctl
peon ALL=(ALL) NOPASSWD:/usr/bin/systemctl /usr/sbin/reboot

I tryed :

 peon ALL =NOPASSWD: /usr/bin/systemctl restart myscript.service,/usr/bin/systemctl start myscript.service,/usb/bin/systemctl stop myscript.service

But everytime i use this command on a bash terminal, ubuntu ask me for password.

Jeff Schaller avatar
ru flag
Hopefully it's just a typo in the question, but your first command starts with: `sudo /usr/binsystemctl ...` instead of `sudo /usr/bin/systemctl ...`.
Jeff Schaller avatar
ru flag
Does your sudoers file have later rules for your user, perhaps a catch-all that allows any command but *with* a password (*without* a NOPASSWD flag)?
Score:0
us flag

So, after some try i founded a solution....

First i puted my command in the LAST line of visudo not in the middle.

Second : I used this syntax :

peon ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart myscript.service
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.