Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How can I start a system process as other than root?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Bill333
n00b
n00b


Joined: 22 Feb 2003
Posts: 12

PostPosted: Tue Aug 24, 2004 11:00 pm    Post subject: How can I start a system process as other than root? Reply with quote

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
View user's profile Send private message
KingTaco
Developer
Developer


Joined: 22 Aug 2003
Posts: 207
Location: Bay Area, CA

PostPosted: Wed Aug 25, 2004 12:06 am    Post subject: Reply with quote

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
View user's profile Send private message
rtn
Guru
Guru


Joined: 15 Nov 2002
Posts: 427

PostPosted: Wed Aug 25, 2004 12:29 am    Post subject: Reply with quote

You could just as easily do it with /bin/su.

Code:
/bin/su - <user> -c <command>


--rtn
Back to top
View user's profile Send private message
FloppyMaster0
n00b
n00b


Joined: 07 May 2004
Posts: 62
Location: Detroit, MI, USA

PostPosted: Wed Aug 25, 2004 6:41 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum