Run octopi comands like sudo without pasword


#1

I just install octopi in ubuntu and problem i got after is my user not run sudo without password like in raspbian
I just try to configure sudo to run octopi without password but without success
sudo visudo
user ALL = NOPASSWD: /home/user/OctoPrint/venv/bin/octoprint

not working!
thank you


#2

I think you've got too many things typed in there...

nosudo


#3

Guy does the following for the OctoPi image on Raspbian. Search that for "sudoers".


#4

Thank you
Is working :slight_smile:
only one problem i have with this but I'm not sure is possible
1 user can reboot system without password
2. user can start and stop any service without password
I'm not sure if visudo or sudoers.d can implement something like this but only for specific program like octoprint and for specific user, any others to not be allowed

I will try to dig a little bit more on this

I appreciate if somebody can tell me how is command shell executed by octoprint on reboot or daemon restart for example to be more clear in mind what i want to do


#5

I write again very fast for who is interesting in.

  1. For octoprint daemon is more good:

user ALL=NOPASSWD: /usr/sbin/service octoprint *

this is happen only for octoprint service, not for all services in sistem

  1. For reboot shutdown I think system cannot know from where command is, he know only to execute so

user ALL=NOPASSWD: /sbin/shutdown

thank you again for advice's, example taken from OutsourcedGuru post

I duplicate yesterday by mistake this post with another like
octoprint with user under linux

maybe somebody can delete it


#6

Not sure what it will look like on Ubuntu, but on the octopi install the user pi is in the group sudo
root@octopi:~# grep sudo /etc/group
sudo:x:27:pi

Then the group sudo is in the /etc/suders file with allow all

Allow members of group sudo to execute any command

%sudo ALL=(ALL:ALL) ALL

Should be able to duplicate that in ubuntu I would think