User account for service, auto starting service.

Alexander Dalloz alexander.dalloz at uni-bielefeld.de
Sat Mar 13 18:05:32 UTC 2004


Am Sa, den 13.03.2004 schrieb George Lemos um 16:53:
> Few questions pertaining to a fedora fc1 server I just set up to host a game
> server. I went to the archive but got a big red "Temporarily Unavailable".
> 
> 1. In windows you can go to services and tell it what user account to run
> that service at. If I understand this correctly, in order to do that in
> Linux do you install the program files into a particular users home
> directory in order for it to run as that user? If this is not how it works
> in Linux, how does a person get a server process to operate under another
> account other than root?

The data for such a process have not necessarily be in user's home, but
certainly the user must have full rights to the file especially when
it's needed to write things like log files, a pid file or other things
typical for daemon processes. To be short: having that in the user's
home is not that bad.

> 2. I am able to run the game server process when logged in as this
> particular user by going to the home directory and typing in the long
> command to get it going. I was told I can get it to go on automatically upon
> boot-up if I enter a line into /etc/rc.d/rc.local pointing directly to the
> program to run. Didn't seem to work. What is the correct way to fire up a
> service upon startup of the server?

/etc/rc.local runs as root during bootup. If you want to start your game
server process this way you need to make use of "su".

I would recommend you write an init script to be put in /etc/init.d/.
How such a start/stop script has to look out is described in
/usr/share/doc/initscripts-7.42.2/sysvinitfiles. Inside this script you
too have to make use of "su". The call may look like: su gameuser -c
"/home/gameuser/server". Having the init script prepared run chkconfig
(with parameters) to add the script to the desired runlevels.

> 3. Finally, when entering in a command to start a server process and ending
> it with an &, isn't it supposed to stay running? When connecting via putty
> and I start this program manually and put an & at the end, then turn off
> putty essentially killing the session, the server process I started ended.
> Am I interpreting the use of & incorrectly?

& sets the process only into background. Logging out such a process will
stop. That is normal. You may need to start the process with "nohup".
(An other thing for other purposes is to run a command in "screen".)

> Thank you for your assistance.
> 
> -George

Alexander


-- 
Alexander Dalloz | Enger, Germany | GPG key 1024D/ED695653 1999-07-13
Fedora GNU/Linux Core 1 (Yarrow) on Athlon CPU kernel 2.4.22-1.2174.nptl
Sirendipity 18:52:19 up 4 days, 19:11, load average: 0.18, 0.17, 0.13 
                   [ Γνωθι σ'αυτον - gnothi seauton ]
             my life is a planetarium - and you are the stars






More information about the users mailing list