[Klug-general] Running a process as a different user

George Prowse cokehabit at gmail.com
Sun Oct 9 21:31:25 BST 2005


Laurence Southon wrote:
> Hi,
> 
> Debian Sarge box.
> 
> I've installed a non-Debian program which runs as a daemon, contolled by 
> a script in /etc/init.d
> 
> It runs fine, but I would like to run it as a user other than root.
> 
> I feel a bit stupid not knowing the answer, but how do I do this?
> 
> Regards,
> 
> Laurence Southon
> 
> _______________________________________________
> Kent mailing list
> Kent at mailman.lug.org.uk
> http://mailman.lug.org.uk/mailman/listinfo/kent
> 
The way I see it, you have two options:

1) create a group like initdrun and chmod and chgrp it like this:

groupadd initdrun

then chgrp /etc/init.d/* to initdrun

then chmod g+rx /etc/init.d/*

2) A slightly better and easier way would be to use sudo.

Add
<user name> ALL = NOPASSWD: /etc/init.d/*
to the config.

That will allow whatever name you choose to run all the scripts in there.



More information about the Kent mailing list