1

Topic: [HELP] Server on Linux Debian

Is there a way to set up a Teeworlds Server on Debian or only on Ubuntu? (I've read the tutorial, but this works only on Ubuntu hmm)

ragards

2

Re: [HELP] Server on Linux Debian

Do you refer to this tutorial?
It's the first time I see it, and it is a bad tutorial. Don't run the server as root! Also I think sv_sendheartbeats and masterserver are deprecated options and will no longer work.
Apart from that, it should work with Debian. But you could also use this tutorial.

aka cheesy

3 (edited by Kottizen 2010-08-12 13:53:16)

Re: [HELP] Server on Linux Debian

Teewee, I just made a short tutorial (was bored), should work: http://jennie.kottnet.net/teeworlds/doc … Debian.pdf

4 (edited by erd 2010-08-12 18:46:30)

Re: [HELP] Server on Linux Debian

Kottizen's tutorial wrote:

Teeworlds servers should be started inside a “screen”. If you run a program inside a screen, it won't
shutdown when you close your PuTTY/ssh window.

No need to install screen, just add an "&" at the end of the command and it will be decoupled from the terminal.
Also I personally prefer to install as less software as possible on a server, I would compile at home if you need the development(!) version and not install gcc and g++. If you want to run 0.5 and not 0.5 trunk, you can just download it (64bit):

wget http://teeworlds.com/files/teeworlds-0.5.2-linux_x86_64.tar.gz

and unpack it. Should work with

tar -xzf ./teeworlds-0.5.2-linux_x86_64.tar.gz 

or, easier, "unp", but needs to be installed manually. And, of course, like the other mentioned: never start teeworlds as root ;-)

But what problems have you exactly setting up the server? Doesn't it appear online? Isn't it possible to connect to it? If it does not even start up, is there an error message? ...

Edit:

Kottizen's tutorial wrote:

adduser teeworlds
...and add that account in /etc/sudoers.

Uhm, why should the teeworlds user be able to use sudo?

5 (edited by Kottizen 2010-08-12 19:56:38)

Re: [HELP] Server on Linux Debian

erd wrote:
Kottizen's tutorial wrote:

Teeworlds servers should be started inside a “screen”. If you run a program inside a screen, it won't
shutdown when you close your PuTTY/ssh window.

No need to install screen, just add an "&" at the end of the command and it will be decoupled from the terminal.
Also I personally prefer to install as less software as possible on a server, I would compile at home if you need the development(!) version and not install gcc and g++. If you want to run 0.5 and not 0.5 trunk, you can just download it (64bit):

wget http://teeworlds.com/files/teeworlds-0.5.2-linux_x86_64.tar.gz

and unpack it. Should work with

tar -xzf ./teeworlds-0.5.2-linux_x86_64.tar.gz 

or, easier, "unp", but needs to be installed manually. And, of course, like the other mentioned: never start teeworlds as root ;-)

But what problems have you exactly setting up the server? Doesn't it appear online? Isn't it possible to connect to it? If it does not even start up, is there an error message? ...

Edit:

Kottizen's tutorial wrote:

adduser teeworlds
...and add that account in /etc/sudoers.

Uhm, why should the teeworlds user be able to use sudo?


No, you don't need to download and compile the development version, but the tutorial is made to learn its users as much as possible, therefore I use screen too. In this case, the development version is more stable than the "stable".

The teeworlds user should have sudo to make it easier for the admin to install necessary software, or to make changes which requires root privileges. Of course, if you really care about security, this is not an option, but the tutorial is made for beginners, who probably don't take security so seriously, even if they should.

However, thanks for the feedback.

6 (edited by lamefun 2010-08-13 02:04:41)

Re: [HELP] Server on Linux Debian

Kottizen wrote:

The teeworlds user should have sudo to make it easier for the admin to install necessary software, or to make changes which requires root privileges. Of course, if you really care about security, this is not an option, but the tutorial is made for beginners, who probably don't take security so seriously, even if they should.

Err... maybe one can just have 2 ssh connections, for root and teeworlds user, instead of giving sudo to teeworlds user? That's even easier I think.

7

Re: [HELP] Server on Linux Debian

Rootlogin itself is dangerous, create another user with sudo privilegies and use public key authentification big_smile Btw, it is also possible to change the current user with "su username".

But ok, if this tutorial is for beginners it should be ok, it's good that you mentioned that it is dangerous to execute teeworlds as root, I can't understand how people can write tutorials which advise to start the server with "sudo ./teeworlds_srv -f bla" hmm

On the other side, server owners should know how to protect the server and of course take care about security, it can be very dangerous and expensive for them if they don't care. But this is another topic, and the thread opener didn't even mentioned that he owns a server wink If you do, teewee, I just hope you know what you are doing!

8 (edited by Mo2 2010-08-28 10:52:41)

Re: [HELP] Server on Linux Debian

Maybe that can even give some more hint to increase security and do some other stuff more common way - without guarantee of course wink:

After you got the teeworlds_srv binary compiled as described in the .pdf from Kottizen above you may want to do even this:

In shell as root. Install a simple and mostly preconfigured firewall (no need for graphical environment or iptables brainstorm):

apt-get install arno-iptables-firewall         # allow port 8303 UDP and TCP - and normally Port 22 for SSH                            

Get sure you really have a user for teeworlds (see .pdf above) if you have not already created make now:

adduser teeworlds

If you would not use screen to run the server create a file called "/etc/init.d/teeworlds-server1" with the texteditor you like ('nano /etc/init.d/teeworlds-server1' if you are noob):

Copy and paste following into that file - change the path if you need to (TEEPATH is the path where you have your teeworlds_srv hanging around), save the file and close it:

#!/bin/sh
TEEPATH="/home/teeworlds/teeworlds-dir"
TEEBIN="teeworlds_srv"
TEECONF="config.conf"
TEEPID="$TEEPATH/teeworlds.pid"
TEEUSER="teeworlds"
TEEGROUP="teeworlds"



start() {
        echo "Starting Teeworlds-Server"
        start-stop-daemon --start --background --chuid $TEEUSER:$TEEGROUP --pidfile $TEEPID --make-pidfile --chdir $TEEPATH --exec $TEEPATH/$TEEBIN -- -f $TEECONF
}

stop() {
        echo "Stopping Teeworlds-Server"
        start-stop-daemon --stop --quiet --pidfile $TEEPID
}

status() {
        if [ -f "$TEEPID" ]; then
          CHECKPID=`cat $TEEPID`
          FOUND=0
          for ALL in `pgrep $TEEBIN`; do
            if [ $ALL  = $CHECKPID ]; then
              echo Teeworlds-Server is running at PID: $CHECKPID
              FOUND=1
            fi
          done
          if [ "$FOUND" = "0" ]; then
            echo Teeworlds-Server seems to be stopped.
            if pgrep -u $TEEUSER $TEEBIN; then
              echo But one ore more process seems to be running...
            fi
          fi
        else
          echo PID-file not found!
          if pgrep -u $TEEUSER $TEEBIN; then
            echo But one ore more process seems to be running
          fi
        fi
}
case "$1" in
        start)
                start
        ;;
        stop)
                stop
        ;;
        restart)
                stop
                sleep 5s
                start
        ;;
        status)
                status
        ;;
        *)
                echo 'Usage: $0 {start|stop|restart|status}'
        ;;
esac

Make the file executeable:

chmod 755 /etc/init.d/teeworlds-server1

To start the server do following (as root - the user for the service is given in the script at the start-stop-daemon line):

/etc/init.d/teeworlds-server1 start


If you would like to run a second server later - do the same again with a second user (for example teeworlds2) and a second init-file (/etc/init.d/teeworlds-server2). So you can easy restart just one teeworlds-server. Use a different port in the teeworlds config and do that as root:

dpkg-reconfigure arno-iptables-firewall       # allow the different port too - for example 8304 UDP / TCP

If you would autostart your server make following:

cd /etc/rc`grep initdefault /etc/inittab | cut -f2 -d':'`'.d'            # normally a simple cd /etc/rc2.d should do as well
ln -s ../init.d/teeworlds-server1 S99teeworlds-server1



More advanced (and have not many to do with TW itself except that it's some server-stuff) - maybe do not alone and ask for some help if you are a linux-noob:

Secure your SSH-Server a little bit more (but be carefull to don't lock you out - means at least keep your session open and try a additional login before you logout first):

Add a user for exclusive SSH login for example:

adduser sshuser

Make a backup of your "/etc/ssh/sshd_config" ('cp /etc/ssh/sshd_config sshd_config.orig')
Open "/etc/ssh/sshd_config":
Add following lines (or change current one if they already exist):

AllowUsers sshuser
PasswordAuthentication no
ChallengeResponseAuthentication no
PermitEmptyPasswords no
PermitRootLogin no
PubkeyAuthentication yes

Create a public/private-key-pair.
If your SSH-client is some Linux-PC too run ssh-keygen on the client-pc:

ssh-keygen

Place the content of the public key of your client (normaly found in ~/.ssh/id_rsa.pub) into the .ssh/authorized_keys file in the homedir of your newly created user on the server. That means on the client-pc do:

nano ~/.ssh/id_rsa.pub           # copy the content from that file of the SSH-client-PC

On the server do:

su - sshuser
mkdir .ssh 
nano ~/.ssh/authorized_keys          # and paste the previous copied content from the client to the server into that file, write and quit

Restart the SSH-Server (still DON'T LOG OUT - keep all your SSH-windows open):

/etc/init.d/ssh restart

Now try to login from your client with a second "SSH-Window" (use the previous created username - 'sshuser' in that example). Leave your first SSH-Window still open the hole time. The password you should get asked is not the password from the server but the password that protects your private-key (and which was entered at ssh-keygen). If everything is ok you can even increase your security a bit by changing default ssh-port from 22 to somewhat other (just to give portscanners a bit more work). If something does not work replace the sshd_config with the sshd_config.orig backup you made before and restart the ssh server again. If you would get root after login just make "su -" in shell.

If your SSH-Client is no Linux-PC (which would be often the case) look here: http://linux-sxs.org/networking/openssh.putty.html - and even get more sure you have a backup of your sshd_config before you start with that stuff. If you don't make something fully fatal normaly you would not get dropped from your current SSH-session after you restart the ssh-service. So chance is not bad that you can play a little bit around. However there is no guarantee so be carefull.


Greetings,
Mo2

9

Re: [HELP] Server on Linux Debian

Mo and his nice guides <3

if you are looking for support for DDRace, please go to http://DDRace.info.

10

Re: [HELP] Server on Linux Debian

Kottizen wrote:

Teewee, I just made a short tutorial (was bored), should work: http://jennie.kottnet.net/teeworlds/doc … Debian.pdf

Thanks, this Tutorial helped me alot! my server is finally up on debian

178.21.114.30:8303 | Hostname: !!FUN SERVER1!! CTF MAP:CTF3 16players
178.21.114.30:8304 | Hostname: !!FUN SERVER2!! CTF MAP:CTF5 16players
Im looking for MODDERS ( servers modding )

11

Re: [HELP] Server on Linux Debian

Kottizen wrote:

Teewee, I just made a short tutorial (was bored), should work: http://jennie.kottnet.net/teeworlds/doc … Debian.pdf

Hey! I know this is a fairly old thread, but is it maybe possible that you still got the PDF? The link seem to have stopped working. Thanks in advance!

12

Re: [HELP] Server on Linux Debian

It's not the exact same tutorial, but an updated version.
http://matilda.kottnet.net/archive/teew … -Linux.htm

13 (edited by lilltonka 2012-04-02 11:49:56)

Re: [HELP] Server on Linux Debian

Kottizen wrote:

It's not the exact same tutorial, but an updated version.
http://matilda.kottnet.net/archive/teew … -Linux.htm

Fast response! Very much thanks! Gonna give it a try later today! smile

EDIT: Worked like a charm! Thanks once again for pointing me in the right direction!