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

Stuart Buckland stuart at nightime.org.uk
Mon Oct 10 09:40:10 BST 2005


On Sun, 2005-10-09 at 20:40 +0100, 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
> 

Laurence,

In your init script use somthing similar to the following:

su - <user> -c <path-to-daemon>

Assuming your filesystem permissions are correct that will start the
daemon as <user> instead of root.

HTH
Stu


-- 
Stuart Buckland <stuart at nightime.org.uk>




More information about the Kent mailing list