MikroTik RouterOS connection templates
The mikrotik/ folder holds three SSH templates for RouterOS, all Core and Pro. RouterOS doesn’t behave like a prompt-driven network CLI, so these templates need one setting on the device record that no template can carry. This page covers release v2.2.2.
Which template
| Template | Use for |
|---|---|
mikrotik-routeros-ssh-noenable |
RouterOS over SSH. Start here |
mikrotik-routeros-ssh-noenable-banner |
Devices that stop at Please press "Enter" to continue! |
mikrotik-routeros-ssh-noenable-noninteractive-vector |
Running commands over a non-interactive SSH exec, from a Vector agent |
Add +cte to the username
On the device record, append +cte to the username: admin+cte, not admin. Each letter switches off one RouterOS console feature: c disables colours, t disables terminal auto-detection, and e enables dumb terminal mode. Together they stop RouterOS dressing its output in escape codes. Without the suffix every step of the session still runs, and the captured output is unusable.
What isMikrotik does
All three templates set isMikrotik: yes. At login, rConfig drains the RouterOS banner and sends one Enter to get past “press Enter to continue”. For each command, it blanks the device prompt and reads with a match-anything pattern, because RouterOS doesn’t present a prompt that regex matching can rely on.
Two things follow:
- The device record still needs a main prompt, but rConfig doesn’t use it.
- rConfig waits for the template’s timeout before sending the next command. The templates ship with 10 seconds, which suits most devices. Raise it for long configurations; lower it if you want jobs to finish faster.
Paging is off in all three: the paging command in the file is never sent.
The templates
rConfig-templates / mikrotik /mikrotik-routeros-ssh-noenable.ymlView on GitHub- Protocol
- SSH, port 22
- isMikrotik
- yes
- Timeout
- 10 seconds
- Status
- community-tested
- Protocol
- SSH, port 22
- Banner
- hpAnyKeyStatus: on
- Timeout
- 10 seconds
- Status
- community-tested
- Protocol
- SSH, port 22
- Mode
- isNonInteractiveMode
- Timeout
- 10 seconds
- Status
- community-tested
Garbled output
If output still carries escape codes or wraps badly, the README suggests adding an options block to your copy of the template:
options: AnsiHost: "yes" setWindowSize: [240, 2048]AnsiHost selects a read path that strips VT100 escape codes; setWindowSize sets the SSH terminal size.