Does anyone know how to allow an unprivileged user to run a certain command as a sudo?
I want a user to run sudo ./exec.o
, where exec.o is an executable that has to be run as a superuser.
All of this will be executed in Ubuntu.
Does anyone know how to allow an unprivileged user to run a certain command as a sudo?
I want a user to run sudo ./exec.o
, where exec.o is an executable that has to be run as a superuser.
All of this will be executed in Ubuntu.
Use visudo, and edit /etc/sudoers to include a line :
USERNAME ALL = NOPASSWD: /path/to/exec.o
Do you want every user to be able to perform the command, or only specific users? The sudo command can elevate privilege for select users, while setting the setuid or setgid bit can provide access the command for all users.
If you only want certain users to perform the command, then using visudo to edit the /etcsudoers file is an effective approach (make sure you get the line correct).
If you want all users to be able to perform the command, then setting the setuid or setgid bit (chmod u+s exec.o) will do the trick (again, be very careful, as this is a big hammer).