Root Script (Was No Subject)

Arthur Dent misc.lists at blueyonder.co.uk
Tue Mar 13 15:58:21 UTC 2012


> I want a process to be running with root privileges, without providing the
> root password. Since i have my process in a remote machine. I want it such
> that, as soon as the system boots up, my process should be running with
> root privilege. Is there any way in which i can attain it?
> Is there any possibility of forking c program as a child process of init
> process.
> If so please guide me on how to do it.
>
> Thank You
>
> --
> *Regards
> Shreyas.M

Well I'm assuming you do have root access to this remote machine? If
that's the case then it could be as simple (if I have understood your
request correctly) as:

1) Log on to the remote machine
2) "su -" + password to attain root privilages
3) create your script (eg: /root/myscript.sh)
4) make it executable "chmod +x /root/myscript.sh"

and then - if you want to have it started at boot time you could put this
in crontab:
5) still as root do "crontab -e" and put in the line:
"@reboot /root/myscript.sh"

NOTE: All the above commands to be entered WITHOUT quotation marks ""

HTH

Mark








More information about the users mailing list