View previous topic :: View next topic |
Author |
Message |
Bill333 n00b

Joined: 22 Feb 2003 Posts: 12
|
Posted: Tue Aug 24, 2004 11:00 pm Post subject: How can I start a system process as other than root? |
|
|
I am putting together an mldonkey P2P server. For security reasons, I would like to run the mldonkey demon as a user. But I also want it to start automatically when the machine boots, so I would:
Code: | rc-update add mldonkey default |
Can anyone tell me how to make sure this process runs from a user account when the server reboots?
Thanks |
|
Back to top |
|
 |
KingTaco Developer


Joined: 22 Aug 2003 Posts: 207 Location: Bay Area, CA
|
Posted: Wed Aug 25, 2004 12:06 am Post subject: |
|
|
Use sudo. edit /etc/init.d/mldonkey and find the following line(s)
Code: | /path/to/mldonkeyd --some options here |
to
Code: | /usr/bin/sudo -u pick_some_user_name_here /path/to/mldonkeyd --some options here |
_________________ Explaining the obvious to the oblivious.
Adopt an unanswered post today -- https://forums.gentoo.org/search.php?search_id=unanswered |
|
Back to top |
|
 |
rtn Guru

Joined: 15 Nov 2002 Posts: 427
|
Posted: Wed Aug 25, 2004 12:29 am Post subject: |
|
|
You could just as easily do it with /bin/su.
Code: | /bin/su - <user> -c <command> |
--rtn |
|
Back to top |
|
 |
FloppyMaster0 n00b

Joined: 07 May 2004 Posts: 62 Location: Detroit, MI, USA
|
Posted: Wed Aug 25, 2004 6:41 am Post subject: |
|
|
I prefer start-stop-daemon for changing the uid of daemons. Just throw this in the init script, filling in the appropriate fields:
Code: | /sbin/start-stop-daemon --start --chuid <user> --exec /path/mldonkeyd -- <mldonkey options> |
You could also use it to chroot your daemon, but that would require some work.
See start-stop-daemon(8) in the manual. |
|
Back to top |
|
 |
|