-   Programming (
-   -   boot process and switching user (

brianm 03-27-2001 02:41 PM

I am trying to run a game server on a Linux machine and what i would like is for it to start automatically when i boot the machine, which i have figured out, however, what i would also like is for it to switch users before it runs so that it is not running as root, but no matter what i try, it seems to switch the user then stall. It never actually starts the game. Any suggestions? Please help me!

crabboy 03-27-2001 11:16 PM

I just wrote a little test script and it worked.



su - crabboy -c "touch dude"

When the script is run as root it will create a file called dude that is owned by crabboy. This means that crabboys shell is actully calling touch; thus working correctly. Have you tried this yet?

If this does not help, then post what you have tried and the exact symptoms.


brianm 03-28-2001 01:02 PM

Thanx for the info on both, however I'm not sure that i understand this one. The file that I have now looks like this. (without the switch user)

cd /home/hlds_l
./hlds_run -game cstrike +maxplayers 18 +map cs_militia &

And i have a link to this in the SysV init config, so that it starts when i boot the machine.

My problem is that when I tried switching users it would boot the computer, switch user, but would not run the game. It is supposed to be in the background as designated by the "&" but what i found was happening is that after it would switch user the shell prompt would come up in the login field and i couldn't do anything after that. It looked something like this:

Login: bash$

and that is all i can get. So if i was to use yours as an example where would i put the name of the game? Also there is a symbollic link to this script called "cstrike" would it be better for me to create the switch user something like yours and call cstrike in that? If so where do i then call cstrike in your script.

Sorry to be so dumb, but thanx for all your help.

brianm 03-28-2001 01:10 PM

I figured it out, that script you wrote is awesome, thank you so much nevermind that last one. This is awesome thanks a lot!!!!!!!!!!!!

All times are GMT -5. The time now is 02:05 AM.