Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

?Automatic daemon launch under account different from root

Status
Not open for further replies.

andrewalx

IS-IT--Management
Mar 28, 2001
31
DE
Hi!
Tell me plz, how to launch daemon automatically under account different from root?
Regards, Andrew.
 
Assuming you mean automatically launch the daemon at boot time, you can put a script in your /etc/rc2.d directory called Snn<scriptname> which would contain the following:

su - <user> -c &quot;<daemon_start_script>&quot;

nn would depend on how soon you wanted the daemon to start after entering the startup procedure (1 for immediately, 99 for the last event etc). It might also be an idea to include the line:

. /<users_home_dir>/.profile

early on in your script so that any environment variables are set correctly. I've just realised I've answered this from a Solaris point-of-view - hopefully the same will apply to Linux variants. Others may be able to confirm this. Cheers.
 
Hi,

It does vary by distro. Redhat init scripts call the 'daemon' script and this takes arguments - something like :

daemon --check xfs su xfs -c &quot;xfs&quot;

Debian has 'stop-start-daemon' as illustrated in the following script -->
Probably best is to do a 'ps -aux' and find some non-root processes (e.g. httpd) and then look at the code of the related init script in /etc/rc.d/init.d (probably - varies by distro)

Hope this helps
 
I think you just want to be able to run a server process
as a non-root user?&quot; Assuming you have a daemon that can bind the necessary unix or inet socks as a non-priviliged user
you can run it from xinetd or inetd. Instead of the &quot;root&quot;
user field in the .conf file, you can specify the user you wish the process to run as.

Bye.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top