How do I run a script as a root user?

Nam Phong

New member
How do I run a script as a root user?
Answer
Write your script, with the commands you want to run as root, and save it e.g. as /path/to/root-script.sh . Make root (or the desired user) the owner of the script. Set the setuid bit on the script, with other desired permissions. (make sure it is not universally writable etc.)
 

Tìm kiếm

Back
Top