Sudo Root – Running Program as Root Without Using Sudo with Normal User Account

rootsudo

Is there a way to force to run program as root (with normal user) when there's no sudo on the machine (and can't be added)?

Best Answer

Sure: you can set the setuid bit. On a modern system, the simplest command is:

# chmod u+s myprogram

or, if the program is already known to have mode 755:

# chmod 4755 myprogram

This assumes the program is owned by root. You'll need to change the file's owner, too, if it is currently owned by someone else.

Do read that Wikipedia article, particularly the Security section. There's a reason only root can do this to a file, and why few executables on your system have this bit set already.

Related Question