How to Ban Players on a TF2 Server: banid, banned_user.cfg and SourceMod
There are two layers for bans on a TF2 server: the built-in engine commands, and SourceMod, which adds a friendlier system. Understanding both keeps your bans from disappearing.
Built-in bans
The engine can ban by SteamID or IP. The banid command takes a time in minutes, with 0 meaning permanent, followed by the user ID or SteamID. The command writeid saves the SteamID list to banned_user.cfg, and writeip saves IPs to banned_ip.cfg. Because these lists are only loaded if you tell the server, add exec banned_user.cfg and exec banned_ip.cfg to server.cfg so they apply after a restart.
Check the list file names in your tf/cfg folder in the Files tab.
SourceMod bans
If SourceMod is installed, admins with the right flags can use:
- sm_ban followed by a player and a time in minutes, with 0 for permanent, and an optional reason
- sm_unban followed by a SteamID
- sm_addban to ban a SteamID for someone who is not online
Use the admin menu from sm_admin if you prefer menus. SourceMod keeps its ban list in its own storage, so it is separate from banned_user.cfg.
Tips
- Ban by SteamID rather than IP, since IPs are shared and change.
- Always give a reason so other admins understand later.
- Use timed bans for first offenses and permanent ones for cheating.
- Keep a note of who issued which ban.
- Back up your ban files and configs before server changes.
Problems
- Bans vanish after restart: they were never written to a file, or the file is not executed.
- A banned player returns on a new account: SteamID bans only cover the account, so keep moderators active.
- An admin cannot ban: their flag does not include ban rights, so check the flag letters in the admin file.
Shared bans
Some communities use external SourceMod ban systems that share a list between servers. These need extra plugins and a database, so read their documentation first.
Ask us on Discord if you want help choosing a setup that suits your community size.