Skip to content
Guides & References

Prompts, privilege and paging

How rConfig decides a command has finished, how it reaches privileged mode, and why paging, banners and prompt patterns break backups.

Connection TemplatesUpdated
On this page

Prompts, privilege and paging

A CLI backup is a conversation that rConfig can only follow by recognising prompts. It sends a command, reads until it sees the prompt again, and takes everything in between as the output. Most backup failures that aren’t network or credential problems come down to one of three things on this page: a prompt rConfig never sees, a privilege step that goes wrong, or output that stops at a pager.


Two kinds of prompt, in two places

Prompt Where it’s set What rConfig does with it
Login prompts (username, password, enablePassPrmpt) The template’s auth section Waits for each before sending the matching credential
Main prompt The device record Waits for it after every command, so it marks the end of each output
Enable prompt The device record Waits for it before sending the enable command (see below)

Login prompts are shared by every device on the template, which suits them: Password: looks the same everywhere. The main and enable prompts usually contain the hostname, so they belong to the device. When a backup comes back empty or slow, check the device’s prompts before the template.

The enable prompt is the one before enable

With enable mode on, the SSH login runs in this order:

  1. Wait for the device’s enable prompt, then send enableCmd.
  2. Wait for enablePassPrmpt, then send the enable password from the device record.
  3. Wait for the device’s main prompt.

So the enable prompt is the prompt the device shows before you type enable, typically the user-mode prompt such as host>, and the main prompt is the privileged one, such as host#. On a device whose prompt doesn’t change at enable, set both to the same value.

The IP Infusion OcNOS template uses this order to handle a device that asks for no password at enable: its enablePassPrmpt is a pattern that matches the privileged prompt itself, so step 2 matches straight away. See the IP Infusion page.

Writing a prompt pattern

Prompts are matched as regular expressions. Enter the pattern only, with no / or ~ delimiters. rConfig adds its own.

  • Specific beats broad. core-sw-01# matches quickly and rarely misfires. .*# covers many devices but also matches a # anywhere in the output, so a FortiGate config with comment lines stops at the first one and comes back truncated.
  • Escape what regex treats as special. Brackets, parentheses, dots, $ and ? in a prompt need a backslash. A FortiGate prompt that ends in $ needs \$.
  • Configuration modes usually look after themselves. For snippet sends, rConfig also matches the main prompt followed by a mode such as (config-if)#, so you rarely need a separate pattern for configuration mode.

A timeout that is too short and a prompt that never matches look the same from outside: both end in a timeout. Raising the timeout first usually turns a fast failure into a slow one. Watch the session in the Live Debug Console and read the last thing the device sent before rConfig gave up.

Privilege: enable or not

Most templates come in enable and noenable pairs. The choice is about the account, not the device:

  • If AAA or the local user puts the backup account straight into full privilege, use noenable. There is no enable password to store or rotate, and one less step to fail.
  • If the account lands in a restricted mode, use enable and give the device record an enable password.

enableCmd doesn’t have to be enable. It is whatever the device needs to reach the mode where configuration can be read, sent as written. The HP 1920 sends _cmdline-mode on followed by a confirmation keystroke; some Palo Alto templates use it to set CLI output options. When the device asks for a username at enable, enableUsername and enableUsernamePrmpt handle it, over SSH only.

Paging

Network CLIs pause long output at a --More-- style prompt. rConfig turns paging off for the session with pagingCmd and turns it back on at the end with resetPagingCmd. If paging stays on, the backup stalls at the first pager prompt and the stored config stops after one screen.

Vendor family Paging command in the template
Cisco IOS, Arista, Dell terminal length 0
Cisco ASA terminal pager 0
Juniper Junos set cli screen-length 0
HP Comware, Huawei VRP screen-length disable, screen-length 0 temporary
Extreme EXOS disable clipaging
Palo Alto PAN-OS set cli pager off
Fortinet FortiOS A three-line config system console sequence

Three things to know about how these commands are sent:

  • On SSH, paging must be on for pagingCmd to be sent. It reads as “turn paging off: on”. On telnet the command is always sent.
  • A multi-line value is sent as written. FortiOS needs config system console, set output standard and end, and the template puts all three in one value.
  • The paging step is just the point in the login where rConfig sends a command and waits for the prompt. Some templates use it for something else: the pfSense template sends 8 to leave the console menu for a shell.

Some platforms have no pager to turn off (Alcatel-Lucent AOS, Opengear), or manage it on the device (NVIDIA Onyx). Their templates leave paging off.

Banners, splash screens and “press any key”

Anything the device shows between login and its first prompt has to be dealt with, or rConfig sits waiting for a prompt that never comes.

Situation Template feature Example
A banner that needs a keystroke to accept vt100 section: read up to some text, send a control code Fortinet banner template, Avaya ERS, Siemens RUGGEDCOM
HP-style “Press any key to continue” hpAnyKeyStatus: on HP ProCurve, Aruba AOS-S
RouterOS banner and “press Enter” isMikrotik: yes MikroTik RouterOS
A prompt left unread after login, so every output appears under the previous command syncToPromptOnLogin: on (Pro) Alcatel-Lucent OmniSwitch template
A device that asks for the password inside the session sshInteractive: on, empty username (Pro V8.4.2) SonicWall nousername template

The repository’s order of operations shows exactly where in the login each of these runs, which is the fastest way to work out why one isn’t taking effect.

rConfig-templates / docs /ORDER-OF-OPERATIONS.mdView on GitHub
What
Login and session stages
Per protocol
SSH, telnet, TL1, script
Includes
Symptom to stage table

Garbled output

Some devices dress their output with terminal escape codes (^[[K and similar). options.AnsiHost: "yes" selects a read path that strips them, and setTerminalDimensions sizes the virtual screen it uses. Raise the second value for very large configurations, which otherwise come back cut short. These options are SSH only. HP, MikroTik and Palo Alto templates use them; most others don’t need them.


Type to search.