Garry's Mod guide

Garry's Mod server.cfg: Essential Settings Explained

By the ChicagoServers team · Updated · 6 min read

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.

Quick answer
  • hostname, sv_password, rcon_password, sv_allowcslua and sv_downloadurl are the core server.cfg lines.
  • Set sv_allowcslua 0 on public servers. It defaults to 1, which lets clients run client-side Lua commands.
  • An empty rcon_password means RCON authentication is refused. Use a long unique one and never post your cfg publicly.
  • Tickrate is set with the -tickrate launch 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
  1. Where server.cfg lives and when it runs
  2. What belongs on the launch line instead
  3. The core settings in server.cfg
  4. Starter server.cfg
  5. FastDL and downloads: sv_downloadurl in practice
  6. Tickrate and network rates
  7. Frequently asked questions
  8. References

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

SettingLaunch formNotes
Gamemode+gamemode sandboxGamemode folder name.
Map+map gm_constructFile name without .bsp.
Player count+maxplayers 32Set 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 27015Default game port 27015.
Any ConVar+<convar> <value>Sets it after the game starts.

The core settings in server.cfg

SettingWhat it doesNotes
hostnameServer name in the browser.Documented as "Hostname for server".
sv_passwordPassword to join. Empty means open.Standard Source engine join password.
rcon_passwordPassword for remote console access.If empty, RCON authentication is refused. RCON uses TCP on the game port (27015 by default).
sv_allowcsluaLets clients run lua_openscript_cl and lua_run_cl.Default 1. Set to 0 on public servers.
sv_kickerrornumDisconnects clients that exceed this many client-side Lua errors.Default 0, which disables it.
sv_downloadurlBase URL of a FastDL web server.Needs matching folder structure; see below.
sv_allowdownload, sv_allowuploadValve's FastDL instructions set both to 1.Set with sv_downloadurl.
host_workshop_autoupdateWhen above 0, updates Workshop addons on server start.Default 1.
hide_serverHides the server from the master server list.Default 0.
mapcyclefileName of the map cycle text file.Used by multiplayer map rotation.
sv_regionRegion 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

A minimal, safe starting point
// 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 1

FastDL 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:

  1. Host a web server

    You need your own HTTP host with enough disk for the downloadable content.

  2. Mirror the folder structure

    Copy files starting at the game folder, so that garrysmod/maps/mymap.bsp on the game server is available at /garrysmod/maps/mymap.bsp on the web server. Point sv_downloadurl at the web folder that contains maps/, materials/ and so on, ending with a slash.

  3. Optionally compress with bzip2

    Clients request a .bz2 compressed copy first and fall back to the plain file. Compression reduces both storage and download time.

  4. List the files

    Mark files with resource.AddFile or resource.AddSingleFile in a serverside Lua file. Only mark addons that contain non-Lua files.

  5. Debug on the client

    If files keep re-downloading, run download_debug 1 and developer 1 in 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.

References