Bad rconpassword.
Cause
Three possibilities, and they look identical from the outside.
1. Flood protection (most likely, if it is intermittent)
CoD applies sv_floodProtect to rcon. Two commands within roughly 500 ms collapse, and
the second returns Bad rconpassword. or an empty reply. If your password works
sometimes, this is what is happening — it is not an authentication problem at all.
Space rcon commands at least 600 ms apart, and treat this response as "probably flood, retry" rather than "wrong password".
2. Wrong cvar name for the game
| Game | Cvar |
|---|---|
| Call of Duty 1, United Offensive | rconpassword |
| Call of Duty 2, CoD4, World at War | rcon_password |
Setting the wrong one leaves rcon disabled with no error at server startup. A config copied between games is the usual cause of a password that never works.
3. The password really is wrong
Read it back on the server console:
/rcon_password
"rcon_password" is:"actual-value^7" default:""
The silent-set trap
Related and worth knowing before you automate anything: set <cvar> <value> over rcon
returns an empty reply whether or not it worked. You cannot distinguish a landed set
from one that flood protection ate.
Always read the cvar back and compare:
rcon('set sv_maxclients 24')
time.sleep(0.7)
assert '"sv_maxclients" is:"24' in rcon('sv_maxclients')
A scheduled job that set a cvar once without verifying, and had the packet dropped, is how a public server ends up stuck in the wrong mode for hours.
