LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-27-2001, 01:41 PM   #1
brianm
LQ Newbie
 
Registered: Mar 2001
Posts: 4

Rep: Reputation: 0
Question


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!
 
Old 03-27-2001, 10:16 PM   #2
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
I just wrote a little test script and it worked.

Code:
#!/bin/sh

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.

Gary
 
Old 03-28-2001, 12:02 PM   #3
brianm
LQ Newbie
 
Registered: Mar 2001
Posts: 4

Original Poster
Rep: Reputation: 0
Gary,
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)

#!/bin/sh
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.
Brian
 
Old 03-28-2001, 12:10 PM   #4
brianm
LQ Newbie
 
Registered: Mar 2001
Posts: 4

Original Poster
Rep: Reputation: 0
Cool

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux boot up process Vs. Windows boot up process darkskull Linux - Software 7 12-30-2006 04:21 PM
kde user switching stefan_nicolau Linux - Software 7 06-17-2005 09:29 AM
Boot process as non-root user fatman Debian 6 06-07-2005 04:08 PM
Fast user switching Davin Linux - General 2 02-17-2004 02:34 PM
Switching between root and user PapaNoHair Slackware 14 07-28-2003 12:58 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration