EN

Game servers

How to Create Your Own Garry's Mod Server

Complete guide to create a dedicated Garry's Mod server on a VPS or dedicated Linux server: SteamCMD, GSLT token, gamemode, Workshop collection, administrators, RCON and systemd service.

11 min read, updated on 18 November 2026

On this page

Your values

Enter them once and the commands in this guide update.

This guide explains how to install and configure a dedicated Garry's Mod server on your VPS or dedicated Linux server: GSLT token, gamemode selection, Workshop collection, administrators, RCON and systemd service.

Order a Server

To host your Garry's Mod server, HostMyServers offers several gaming-oriented options. The Source engine mainly relies on a single core: favor a high-frequency processor.

Prerequisites

  • SSH access as root or user with sudo privileges
  • 64-bit Linux system (Debian 12/13 or Ubuntu 22.04/24.04 recommended)
  • Active firewall: nftables (recommended), iptables or ufw (use only one firewall tool at a time)
  • A Steam account that owns Garry's Mod, to create the GSLT token
  • Port 27015 UDP accessible, and port 27015 TCP (RCON) accessible from your fixed IP address only

Required Configuration

Facepunch does not publish an official configuration for the server. These values are estimates for a Sandbox server, to be adjusted according to the number of players and addons.

Component Minimum Recommended
RAM 2 GB 4 GB and more
CPU 2 cores 4 high-frequency cores
Storage 10 GB 30 GB NVMe SSD, more with the Workshop
Network 100 Mbps 1 Gbps

System Update

Terminal
sudo apt update && sudo apt upgrade -y

Installing Dependencies

SteamCMD and the default version of the server are 32-bit programs. Enable the i386 architecture, then install the required libraries:

Terminal
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y wget tar git lib32gcc-s1 lib32stdc++6 lib32z1 libtinfo6:i386 libncurses6:i386

Creating a Dedicated User

The server must never run as root:

Terminal
sudo adduser --disabled-password --gecos "" gmod

Ports Used

Port Protocol Usage
27015 UDP Game and server list queries
27015 TCP RCON (remote administration), restrict to your IP address

Firewall Configuration

Open the game port to everyone, and restrict RCON to your fixed IP address: replace YOUR_IP.

With UFW

Terminal
sudo ufw allow 27015/udp
sudo ufw allow from YOUR_IP to any port 27015 proto tcp
sudo ufw reload

With iptables

Terminal
sudo iptables -A INPUT -p udp --dport 27015 -j ACCEPT
sudo iptables -A INPUT -p tcp -s YOUR_IP --dport 27015 -j ACCEPT
sudo iptables-save | sudo tee /etc/iptables/rules.v4

Saving the rules across reboots requires the iptables-persistent package.

With nftables

These commands use the inet filter table and the input chain, present by default in /etc/nftables.conf on Debian.

Terminal
sudo nft add rule inet filter input udp dport 27015 accept
sudo nft add rule inet filter input ip saddr YOUR_IP tcp dport 27015 accept
(echo "flush ruleset"; sudo nft list ruleset) | sudo tee /etc/nftables.conf

Installing SteamCMD

Log in as the gmod user:

Terminal
sudo -iu gmod

Create the directories and download SteamCMD:

Terminal
mkdir -p ~/steamcmd ~/gmod-server
cd ~/steamcmd
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -xzf steamcmd_linux.tar.gz

Downloading the Server

Start the server installation (application ID 4020):

Terminal
./steamcmd.sh +force_install_dir /home/gmod/gmod-server +login anonymous +app_update 4020 validate +quit

When it finishes, the message Success! App '4020' fully installed. is displayed.

Creating the GSLT Token

Facepunch requires a GSLT (Game Server Login Token) token for each server. Without a token, the server is heavily penalized in the server list ranking.

  1. Open the Steam Game Server Account Management page
  2. In App ID of the base game, enter 4000 (not 4020)
  3. Add a memo to identify the server, then click Create
  4. Copy the token you get

The Steam account must not be limited, community banned or locked. It must have an eligible phone number and own Garry's Mod.

Server Configuration

server.cfg File

Terminal
nano ~/gmod-server/garrysmod/cfg/server.cfg
Text
hostname "My Garry's Mod Server"
sv_password ""
rcon_password "ChangeMe"
sv_region 3
sv_lan 0

// Sandbox mode limits
sbox_maxprops 200
sbox_maxragdolls 10
sbox_maxvehicles 4
sbox_maxnpcs 10
sbox_godmode 0
sbox_playershurtplayers 1

// Ban lists
exec banned_user.cfg
exec banned_ip.cfg

Protect the file, since it contains the RCON password:

Terminal
chmod 600 ~/gmod-server/garrysmod/cfg/server.cfg
Parameter Description
hostname Public name of the server
sv_password Password to join (empty = public)
rcon_password RCON password
sv_region Server list region (3 = Europe)
sv_lan 0 = server visible on the Internet
sbox_maxprops Maximum number of props per player
sbox_maxragdolls Maximum number of ragdolls per player
sbox_maxvehicles Maximum number of vehicles per player
sbox_maxnpcs Maximum number of NPCs per player
sbox_godmode 1 = invincible players
sbox_playershurtplayers 1 = players can hurt each other

Launch Script

The script gathers the startup parameters and the token:

Terminal
nano ~/gmod-server/start.sh
Terminal
#!/bin/bash
cd /home/gmod/gmod-server

exec ./srcds_run -game garrysmod -console -norestart \
    -port 27015 \
    +maxplayers 32 \
    +gamemode sandbox \
    +map gm_construct \
    +sv_setsteamaccount YOUR_GSLT_TOKEN

Replace YOUR_GSLT_TOKEN, then restrict access to the script:

Terminal
chmod 700 ~/gmod-server/start.sh
Parameter Description
-game garrysmod Game to launch (mandatory)
-console Console mode
-norestart Lets systemd handle restarts
-port Server port
+maxplayers Maximum number of players
+gamemode Gamemode loaded at startup
+map Starting map
+host_workshop_collection Workshop collection to load
+sv_setsteamaccount GSLT token

First Launch

Terminal
~/gmod-server/start.sh

The server is ready when the console indicates it is connected to the Steam servers. Type quit to stop it, then exit the gmod user's session:

Terminal
exit

Configuration as systemd Service

Create Service File

Terminal
sudo nano /etc/systemd/system/gmod.service
Configuration
[Unit]
Description=Garry's Mod Dedicated Server
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=gmod
Group=gmod
WorkingDirectory=/home/gmod/gmod-server
Environment=TERM=xterm
ExecStart=/home/gmod/gmod-server/start.sh
LimitNOFILE=2048
Restart=on-failure
RestartSec=20

[Install]
WantedBy=multi-user.target

Enable and Start Service

Terminal
sudo systemctl daemon-reload
sudo systemctl enable gmod.service
sudo systemctl start gmod.service

Management Commands

Terminal
# Check status
sudo systemctl status gmod.service

# Stop server
sudo systemctl stop gmod.service

# Restart server
sudo systemctl restart gmod.service

# View logs
sudo journalctl -u gmod.service -f

Checking That It Works

Terminal
sudo systemctl is-active gmod.service
sudo ss -ulnp | grep 27015

The service must be active and port 27015 must be listening. Then connect from the game to confirm access.

Connecting to the Server

  1. Launch Garry's Mod
  2. Enable the console in the game options, then open it
  3. Type: connect SERVER_IP:27015
  4. If a password is configured, first type: password YourPassword

You can also add the server to your Steam favorites (View menu, Servers, Favorites tab).

Choosing a Gamemode

The gamemode is set with +gamemode in start.sh. Its value matches the folder name in garrysmod/gamemodes/, with the same capitalization. After every change, restart the service.

Gamemode Value Note
Sandbox sandbox Included, default mode
Trouble in Terrorist Town terrortown Included, requires Counter-Strike: Source content and a ttt_ map
DarkRP darkrp Third-party project, to be installed

Trouble in Terrorist Town

Download the Counter-Strike: Source content as the gmod user (ID 232330):

Terminal
sudo -iu gmod
cd ~/steamcmd
./steamcmd.sh +force_install_dir /home/gmod/css-content +login anonymous +app_update 232330 validate +quit
nano ~/gmod-server/garrysmod/cfg/mount.cfg

Declare this content in mount.cfg:

Text
"mountcfg"
{
	"cstrike"	"/home/gmod/css-content/cstrike"
}

Then edit the launch script, exit the session and restart the server:

Terminal
nano ~/gmod-server/start.sh
exit
sudo systemctl restart gmod.service

In start.sh, use +gamemode terrortown and a ttt_ map present on the server, for example from your Workshop collection. Players without the Counter-Strike: Source content will see missing textures and models.

DarkRP

Install the gamemode from its official repository:

Terminal
sudo -iu gmod
git clone https://github.com/FPtje/DarkRP.git ~/gmod-server/garrysmod/gamemodes/darkrp
nano ~/gmod-server/start.sh
exit
sudo systemctl restart gmod.service

In start.sh, use +gamemode darkrp. Do not modify the repository's files: the project explains how to customize the gamemode and provide its content to players.

Adding a Workshop Collection

Create the Collection

  1. On the Garry's Mod Workshop, create a collection and add your addons to it
  2. Set its visibility to Public or Unlisted: a private collection is not accessible to the server
  3. Note the ID at the end of its address (?id=...)

Load the Collection

Open the launch script:

Terminal
sudo -u gmod nano /home/gmod/gmod-server/start.sh

Add this line before +sv_setsteamaccount, replacing COLLECTION_ID:

Text
    +host_workshop_collection COLLECTION_ID \

Then restart the server:

Terminal
sudo systemctl restart gmod.service

The server downloads the collection and its sub-collections at startup, and checks for updates at every restart. To disable these updates, add host_workshop_autoupdate 0 to server.cfg. Be careful: a server left on an old version of a map can prevent players from connecting.

Listing Addons Without a Collection

Since game version 2026.09.22, you can also declare addons in garrysmod/cfg/srcds_workshop_ids.txt, which you create yourself:

Text
"my_workshop_addons"
{
	"1"
	{
		"wsid"	"123277559"
	}
	"2"
	{
		"wsid"	"111412589"
	}
}

Making Players Download the Content

The collection's maps and the Workshop-linked gamemode are offered to players automatically. For any other addon containing models, textures or sounds, create this file:

Terminal
sudo -u gmod mkdir -p /home/gmod/gmod-server/garrysmod/lua/autorun/server
sudo -u gmod nano /home/gmod/gmod-server/garrysmod/lua/autorun/server/workshop.lua
lua
resource.AddWorkshop( "ADDON_ID" )

Add one line per addon. There is no need to do this for an addon made up solely of Lua code, and a collection ID is not accepted here.

Administration

Adding Administrators

First get the player's SteamID (in the STEAM_0:X:XXXXXXXX format) with the status command, once they are connected. Then edit the user list:

Terminal
sudo -u gmod nano /home/gmod/gmod-server/garrysmod/settings/users.txt
Text
"Users"
{
	"superadmin"
	{
		"YourNickname"	"STEAM_0:X:XXXXXXXX"
	}

	"admin"
	{
		"AModerator"	"STEAM_0:X:XXXXXXXX"
	}
}

Restart the server to apply the list. When a player connects, a message confirms their group. Steam must have authenticated the player: if the group is not applied, restart Steam and reconnect.

The game does not provide a full administration menu. To add one, you can install the third-party addons ULib and ULX in garrysmod/addons/.

Using RCON

Your IP address must be allowed on TCP port 27015. In the game console:

Text
rcon_address SERVER_IP:27015
rcon_password YourPassword
rcon status
Command Description
status Shows connected players and their SteamID
changelevel <map> Change the map
kickid <userid> Kick a player
banid <minutes> <steamid> kick Ban a player (0 = permanent)
removeid <steamid> Remove a ban
writeid Save the bans to banned_user.cfg
say <message> Send a message to all players
exec server.cfg Reload the configuration
quit Stop the server

Server Update

Stop the server, back up your configuration files, then update:

Terminal
sudo systemctl stop gmod.service
sudo -iu gmod
cp ~/gmod-server/garrysmod/cfg/server.cfg ~/server.cfg.bak
cp ~/gmod-server/garrysmod/settings/users.txt ~/users.txt.bak
cd ~/steamcmd
./steamcmd.sh +force_install_dir /home/gmod/gmod-server +login anonymous +app_update 4020 +quit
exit
sudo systemctl start gmod.service

If you installed DarkRP, update it too with git -C ~/gmod-server/garrysmod/gamemodes/darkrp pull, from the gmod user's session.

Automatic Backup

Backup Script

Terminal
sudo nano /home/gmod/backup.sh
Terminal
#!/bin/bash
umask 077
BACKUP_DIR="/home/gmod/backups"
GAME_DIR="/home/gmod/gmod-server/garrysmod"
DATE=$(date +%Y-%m-%d_%H-%M-%S)

mkdir -p "$BACKUP_DIR"
cd "$GAME_DIR" || exit 1

# Keep only the items that exist
ITEMS=()
for item in cfg settings data addons sv.db lua/autorun/server; do
    [ -e "$item" ] && ITEMS+=("$item")
done

tar -czf "$BACKUP_DIR/gmod_$DATE.tar.gz" "${ITEMS[@]}"

# Delete backups older than 7 days
find "$BACKUP_DIR" -name "gmod_*.tar.gz" -mtime +7 -delete

echo "Backup completed: gmod_$DATE.tar.gz"
Terminal
sudo chown gmod:gmod /home/gmod/backup.sh
sudo chmod 700 /home/gmod/backup.sh

The sv.db file is the server's SQLite database: many addons and gamemodes store their data in it.

Schedule Backup

To get a consistent database, this task stops the server during the backup, then restarts it:

Terminal
sudo crontab -e
Text
# Backup and restart every day at 5 AM
0 5 * * * systemctl stop gmod.service; sudo -u gmod /home/gmod/backup.sh; systemctl start gmod.service

Troubleshooting

The server won't start

  • Check the logs: sudo journalctl -u gmod.service -n 100

  • Check that the GSLT token is valid, has not expired and was created with App ID 4000

  • Check that start.sh is executable: sudo -u gmod ls -l /home/gmod/gmod-server/start.sh

  • Look for a missing library:

    Terminal
    sudo -u gmod bash -c 'cd ~/gmod-server && LD_LIBRARY_PATH=.:bin ldd srcds_linux | grep "not found"'

linux32/steamcmd: No such file or directory

This message usually means that the 32-bit libraries are missing, even though the file exists. Install them:

Terminal
sudo apt install -y lib32gcc-s1

libtinfo.so.5 or libncurses.so.5 Warning

Recent versions of Debian and Ubuntu no longer provide these old libraries. Create links to the version 6 files:

Terminal
sudo ln -sf /usr/lib/i386-linux-gnu/libtinfo.so.6 /usr/lib/i386-linux-gnu/libtinfo.so.5
sudo ln -sf /usr/lib/i386-linux-gnu/libncurses.so.6 /usr/lib/i386-linux-gnu/libncurses.so.5

steamclient.so Error

Create the link to SteamCMD's 32-bit file:

Terminal
sudo -u gmod mkdir -p /home/gmod/.steam/sdk32
sudo -u gmod ln -sf /home/gmod/steamcmd/linux32/steamclient.so /home/gmod/.steam/sdk32/steamclient.so

Players can't connect

  • Check that port 27015 is open over UDP:

    Terminal
    sudo ufw status
    sudo iptables -L INPUT -n --line-numbers | grep 27015
    sudo nft list ruleset | grep 27015
  • Check that the server is listening: sudo ss -ulnp | grep 27015

  • Wait for the Workshop download to finish at startup

The server doesn't appear in the list

  • Check that sv_lan 0 is set in server.cfg
  • Check in the logs that the GSLT token is being taken into account
  • Wait a few minutes after startup

The Workshop collection doesn't download

  • Check that the collection is public or unlisted
  • Check the ID in start.sh
  • Check the disk space: df -h

Purple textures or ERROR models

The content is missing on the player's side. Add the addon with resource.AddWorkshop, or check mount.cfg if the content comes from another game.

The gamemode or an addon isn't loaded

Linux is case-sensitive. The name passed to +gamemode must exactly match the folder. For old addons installed by hand, use only lowercase in the folder name and adapt the Lua paths that refer to it.

FAQ

Do I need to open ports for Steam?

If your firewall blocks incoming traffic by default, these rules allow the server to receive replies from the Steam servers:

UFW:

Terminal
sudo ufw allow proto udp from any port 27000:27030 to any port 1025:65535
sudo ufw allow proto udp from any port 4380 to any port 1025:65535
sudo ufw reload

iptables:

Terminal
sudo iptables -A INPUT -p udp -m udp --sport 27000:27030 --dport 1025:65535 -j ACCEPT
sudo iptables -A INPUT -p udp -m udp --sport 4380 --dport 1025:65535 -j ACCEPT
sudo iptables-save | sudo tee /etc/iptables/rules.v4

nftables:

Terminal
sudo nft add rule inet filter input udp sport 27000-27030 udp dport 1025-65535 accept
sudo nft add rule inet filter input udp sport 4380 udp dport 1025-65535 accept
(echo "flush ruleset"; sudo nft list ruleset) | sudo tee /etc/nftables.conf

Is there a 64-bit version of the server?

Facepunch offers an x86-64 branch, which this guide does not cover. Like any development branch, it is updated regularly and may be less stable. See the Garry's Mod wiki before using it.

Can I host several servers on the same machine?

Yes. Use a separate folder, port (-port 27016, to be opened in the firewall), systemd service and GSLT token for each server.