Garry's Mod server.cfg: Essential Settings Explained
Garry's Mod reads garrysmod/cfg/server.cfg when a dedicated server starts and on every map start. Put identity, passwords, security and download settings there. Launch-only things such as the gamemode, map, player count, tickrate and login token belong on the command line.
Descriptions below come from the Facepunch Garry's Mod wiki and the Valve Developer Community wiki. Where the wikis do not document a value, this guide says so rather than guessing.
hostname,sv_password,rcon_password,sv_allowcsluaandsv_downloadurlare the core server.cfg lines.- Set
sv_allowcslua 0on public servers. It defaults to 1, which lets clients run client-side Lua commands. - An empty
rcon_passwordmeans RCON authentication is refused. Use a long unique one and never post your cfg publicly. - Tickrate is set with the
-tickratelaunch option (default 66.6666, suggested range 30 to 128), not in server.cfg. - server.cfg runs on every map start, so the ConVars it sets are reapplied after a map change.
On this page
Where server.cfg lives and when it runs
The file is garrysmod/cfg/server.cfg. Valve's documentation says server.cfg runs when a server starts in dedicated mode and by default on every map start, which means any ConVar it sets is reapplied after a map change. A second file, autoexec.cfg, in the same folder is the other common place for startup commands; the Facepunch wiki uses it for sv_loadingurl.
A few settings cannot be applied from a cfg because they are needed before the server finishes starting. The wiki's -multirun note is an example: sv_lan 1 has to be set before the server starts (or followed by a changelevel) because server.cfg is too late. When in doubt, check whether the wiki documents something as a launch option.
What belongs on the launch line instead
| Setting | Launch form | Notes |
|---|---|---|
| Gamemode | +gamemode sandbox | Gamemode folder name. |
| Map | +map gm_construct | File name without .bsp. |
| Player count | +maxplayers 32 | Set at launch. |
| Workshop collection | +host_workshop_collection <id> | Public or unlisted collections only. |
| Login token | +sv_setsteamaccount <token> | Listed as mandatory on the Facepunch wiki. |
| Tickrate | -tickrate <value> | Default 66.6666. Suggested range 30 to 128. |
| Port | -port 27015 | Default game port 27015. |
| Any ConVar | +<convar> <value> | Sets it after the game starts. |
The core settings in server.cfg
| Setting | What it does | Notes |
|---|---|---|
hostname | Server name in the browser. | Documented as "Hostname for server". |
sv_password | Password to join. Empty means open. | Standard Source engine join password. |
rcon_password | Password for remote console access. | If empty, RCON authentication is refused. RCON uses TCP on the game port (27015 by default). |
sv_allowcslua | Lets clients run lua_openscript_cl and lua_run_cl. | Default 1. Set to 0 on public servers. |
sv_kickerrornum | Disconnects clients that exceed this many client-side Lua errors. | Default 0, which disables it. |
sv_downloadurl | Base URL of a FastDL web server. | Needs matching folder structure; see below. |
sv_allowdownload, sv_allowupload | Valve's FastDL instructions set both to 1. | Set with sv_downloadurl. |
host_workshop_autoupdate | When above 0, updates Workshop addons on server start. | Default 1. |
hide_server | Hides the server from the master server list. | Default 0. |
mapcyclefile | Name of the map cycle text file. | Used by multiplayer map rotation. |
sv_region | Region the server browser reports. | Default 255 (world); Valve notes it may be deprecated. |
sv_region accepts 0 to 7 for US East, US West, South America, Europe, Asia, Australia, Middle East and Africa, and 255 for the world. A server set to a specific region appears when that region or all regions is selected in the browser.
Starter server.cfg
// garrysmod/cfg/server.cfg
hostname "My Garry's Mod Server"
sv_password ""
rcon_password "use-a-long-unique-password"
// Security
sv_allowcslua 0
sv_kickerrornum 0
// Downloads (FastDL)
sv_downloadurl "https://example.com/garrysmod/"
sv_allowdownload 1
sv_allowupload 1
// Workshop updates on start
host_workshop_autoupdate 1FastDL and downloads: sv_downloadurl in practice
Players need custom content that is not already on their machine. The Facepunch wiki ranks the methods from fastest to slowest: Steam Workshop downloads, FastDL over HTTP, then the server's own built-in transfer, which it calls obsolete and slow. For Workshop content, use resource.AddWorkshop and skip FastDL.
For your own maps, models and sounds, FastDL works like this:
- Host a web server
You need your own HTTP host with enough disk for the downloadable content.
- Mirror the folder structure
Copy files starting at the game folder, so that
garrysmod/maps/mymap.bspon the game server is available at/garrysmod/maps/mymap.bspon the web server. Pointsv_downloadurlat the web folder that containsmaps/,materials/and so on, ending with a slash. - Optionally compress with bzip2
Clients request a
.bz2compressed copy first and fall back to the plain file. Compression reduces both storage and download time. - List the files
Mark files with
resource.AddFileorresource.AddSingleFilein a serverside Lua file. Only mark addons that contain non-Lua files. - Debug on the client
If files keep re-downloading, run
download_debug 1anddeveloper 1in the client console and look for red "Error Downloading" lines.
Be aware that FastDL downloads files one at a time, so a very large number of small files is slow, and clients do not re-check files they already have, so updated files may not re-download. Hosting with ChicagoServers? The Garry's Mod server hosting page lists what is included, such as Steam Workshop collection support, free server backups and SFTP file access.
Tickrate and network rates
Source servers simulate in discrete ticks. Garry's Mod's default tickrate is 66.6666, set with -tickrate, with a suggested range of 30 to 128. Valve advises against going above 66 on typical servers, because higher tickrates raise CPU load substantially, and says players should usually only need to adjust their own rate.
Servers constrain what clients request with sv_minrate, sv_maxrate, sv_minupdaterate and sv_maxupdaterate. The Facepunch wiki does not document defaults for these, so leave them at the engine defaults unless you are testing a specific problem. More often, lag comes from a heavy Lua addon, so check the addon list first.
Frequently asked questions
Where is the Garry's Mod server.cfg file?
In garrysmod/cfg/server.cfg on the server. It runs when the dedicated server starts and on every map start, so ConVars it sets are reapplied after map changes.
What should sv_allowcslua be set to?
On a public server, 0. The default is 1, which lets clients run lua_openscript_cl and lua_run_cl, and that is rarely wanted outside private or testing servers.
How do I change the tickrate on a Garry's Mod server?
Use the -tickrate launch option, not server.cfg. The default is 66.6666 and the suggested range is 30 to 128, but higher values raise CPU load.
Do I need FastDL if I use Workshop collections?
Usually not. Workshop downloads are the fastest method, so serve addon content with resource.AddWorkshop and use FastDL only for files you cannot put on the Workshop.