How to Ban Players on Your Counter-Strike 2 Server
Ban players by SteamID or IP on your CS2 dedicated server using banid, banip, banned_user.cfg, and banned_ip.cfg.
CS2 inherits the Source ban system. Bans are applied with console/RCON commands and persisted to two files in game/csgo/cfg/:
banned_user.cfg— SteamID bansbanned_ip.cfg— IP bans
Ban a Player by SteamID
Find the player's user ID with the status command (RCON or console).
Run:
banid <minutes> <userid><minutes> of 0 = permanent. Example: banid 0 12 permabans user ID 12.
Save the ban list to disk so it persists across restarts:
writeidBan a Player by IP
Find the user ID with status.
Run:
banip <minutes> <userid>Save:
writeipAuto-Load Bans on Startup
Make sure your server.cfg ends with:
exec banned_user.cfg
exec banned_ip.cfg
writeid
writeipThis loads the lists every time the server starts.
Unban a Player
removeid <steamid>
writeidremoveip <ip>
writeipEdit Ban Files Directly
You can also edit banned_user.cfg / banned_ip.cfg in the Files manager. Each line follows this format:
banid 0 STEAM_1:0:12345678Stop the server before editing to avoid being overwritten by writeid/writeip.
Related Guides
How is this guide?
