Posts: 226
Threads: 36
Joined: Oct 2008
Reputation:
0
BASIC INFO
Server OS: Specific version. ex: Debian Lennon 64-bit
Processor: Intel® Core i7 CPU X 980 @ 3.33GHz
Ram: 12GB
Game(s): DODS, TFT2, CSS
Start Up Command: startline="taskset -c 5 ./srcds_run -debug -game cstrike +ip xx.xx.xxx.xxx +hostport 27015 +map de_dust +maxplayers 11 +fps_max 0 -autoupdate"
Admin Mods: none
How do i prevent my server to be started with root. As for now i have to monitor them daily. Because if the server dies the root account restarts the server.
Posts: 226
Threads: 36
Joined: Oct 2008
Reputation:
0
Then the server will not start at all. It´s is possible tu choose user that starts the server?
Posts: 504
Threads: 9
Joined: Oct 2009
Reputation:
3
Thats the point of the code. Force admins that do not care about security to reconsider their behaviour. Also it should remind the rest if the made a small mistake.
Login as normal user and do everything with that.
Chmod 777 using root for the most stuff and so on are really bad ideas.
Posts: 226
Threads: 36
Joined: Oct 2008
Reputation:
0
09-07-2010, 05:27 AM
(This post was last modified: 09-07-2010, 05:28 AM by lhffan.)
Have added your code to my startup script and also done
chown -R user /home/userdir
What more to think about?
Posts: 2,031
Threads: 27
Joined: Nov 2008
Reputation:
17
no, that piece of code will actually prevent the server from starting if the script is running as root. I think this is not what you want. You will want to use the command sudo to run the server as a different user. Just place at the beginning of the line actually starting the server:
where "user" is the name of the user to run the server as.
*****www.fpsmeter.org
*****wiki.fragaholics.de/index.php/EN:Linux_Optimization_Guide (Linux Kernel HOWTO!)
Do not ask technical questions via PM!
Posts: 504
Threads: 9
Joined: Oct 2009
Reputation:
3
09-07-2010, 08:03 PM
(This post was last modified: 09-08-2010, 06:20 AM by Terrorkarotte.)
Which will need the package "sudo". With nearly all systems "su" is installed by default:
su -c "command in here" user
Posts: 2,031
Threads: 27
Joined: Nov 2008
Reputation:
17
(09-07-2010, 08:03 PM)Terrorkarotte Wrote: Which will need the package "sudo". With nearly all systems "su" is installed
you are right. sudo only has advantages if you want normal users to start gameservers as different users without entering a password...
Quote:su "command in here" user
isn't that the other way round?
@lhffan: what do you exactly mean? can you post both the command and the whole error message?
*****www.fpsmeter.org
*****wiki.fragaholics.de/index.php/EN:Linux_Optimization_Guide (Linux Kernel HOWTO!)
Do not ask technical questions via PM!
Posts: 226
Threads: 36
Joined: Oct 2008
Reputation:
0
I cant just add
su - cssserver
to my scripts that starts the servers?
Without parameters?
Will the system not then ask for passw if i run the file in as a cronjob under user cssserver?