Remote Administration with RCON
How to enable and use RCON on your Factorio dedicated server to run admin commands remotely from outside the panel console.
Overview
RCON (Remote Console) lets you send admin commands to your Factorio server over a TCP connection without using the panel's web console. It is useful for external bots, Discord bridges, automated management scripts, and off-panel administration.
Enabling RCON
Add the RCON flags to the server startup command:
./factorio/bin/x64/factorio --start-server saves/save.zip \
--rcon-port 27015 \
--rcon-password "yoursecretpassword"
On WISP/Pterodactyl, the standard Factorio egg exposes RCON_PORT and RCON_PASSWORD as startup variables. Set these in the Startup tab of your server. The egg injects them into the startup command automatically. Confirm the startup command contains --rcon-port {{RCON_PORT}} --rcon-password {{RCON_PASSWORD}}.
Port Requirements
RCON uses TCP (not UDP). The RCON port must be:
- Distinct from the game port (default game port is UDP 34197).
- Open in the firewall for TCP inbound if you need external access.
- Allocated to your server in the WISP/Pterodactyl port pool.
If RCON is only used by scripts running on the same machine (e.g., a Discord bot on the same node), you can bind RCON to localhost and skip the firewall rule.
Connecting with an RCON Client
Python (factorio-rcon):
pip install factorio-rcon
python -c "
import factorio_rcon
client = factorio_rcon.RCONClient('your.server.ip', 27015, 'yoursecretpassword')
print(client.send_command('/time'))
"
Node.js (FactorioRconTool):
Install via npm and use the API or CLI as documented in the package.
Netcat (quick test):
RCON is a binary protocol, so raw netcat does not work cleanly. Use a proper RCON client for testing. The Python method above is the simplest quick test.
Running Commands via RCON
Any command you can run in the server console can be run via RCON. Examples:
/time
/evolution
/perf
/kick PlayerName
/ban PlayerName
/c game.print("hello from RCON")
Commands that produce output return it as the RCON response. Commands like /kick return empty on success.
Security Considerations
- Use a strong, random RCON password. Anyone with the password has full server console access including Lua execution.
- Do not expose the RCON port to the public internet unless necessary. Prefer binding to a VPN or localhost when possible.
- Change the default RCON port (27015) if you want to reduce automated scanning exposure.
- Rotate the RCON password if you suspect it has been compromised. Update
RCON_PASSWORDin the panel startup variables and restart the server.
RCON for Automation
Common RCON automation patterns:
- Discord bot that relays
/time,/evolution, and player events to a channel. - Scheduled scripts that post
/perfoutput to a monitoring dashboard. - Automatic
/banexecution based on an external ban list.