Password recovery on Cisco routers and switches: ROMMON, the config register and the mode button
In short: With physical console access you can reset lost passwords on most Cisco devices. On routers you interrupt the boot, set the configuration register so the saved configuration is ignored, copy the configuration back in and set new passwords. Catalyst switches use the mode button or a ROMMON variable. Disabling password recovery protects devices in unsafe locations, at the cost of a full reset if you lose the password.
Why this works, and why it matters
Password recovery needs physical access to the console port and a reload. That is the security model: anyone who can touch the device and power-cycle it can take control. So recovery is a normal admin skill, and it is also the reason network cabinets should be locked.
Routers (ISR 4000 and similar)
- Connect a console cable (9600 baud, 8N1) and power-cycle the router.
- Within the first 60 seconds of boot, send a Break (Ctrl+Break in PuTTY, or the terminal's break key). The router stops at the
rommon 1 >prompt. - Type
confreg 0x2142and thenreset. The 0x2142 value tells the router to ignore NVRAM contents on boot. - The router boots with no configuration. Answer no to the setup dialogue, then
enable(no password is needed). - Copy the saved configuration into memory:
copy startup-config running-config. Do not do it the other way round, or you will erase your configuration. - Set new passwords:
enable secret ...and new line or user passwords. Interfaces may now be shut down, so bring them up withno shutdown. - Restore the normal register:
config-register 0x2102, thencopy running-config startup-configand reload.
Catalyst switches
On Catalyst 9000 switches, hold the Mode button while powering on (or for about 10 seconds during boot) to reach the switch: ROMMON prompt. Then:
switch: SWITCH_IGNORE_STARTUP_CFG=1
switch: boot
...
Switch# copy startup-config running-config
Switch(config)# enable secret New-Example-Pass
Switch(config)# no system ignore startupconfig switch all
Switch# write memory
Older Catalyst 2960 and 3560 switches used flash_init and renamed config.text instead; the idea is the same.
Disabling password recovery
For devices in shared or public spaces, no service password-recovery stops the console break from exposing the configuration. If someone uses the recovery procedure, the device erases its configuration before letting them in. Only use this if you keep secure, offline backups of every configuration, because you will have to rebuild the device if you lose the password.
Good practice to avoid needing recovery
- Use AAA with RADIUS or TACACS+ for logins, plus a strong local fallback account stored in a password manager.
- Use
enable secretwith type 8 or 9 hashing (algorithm-type scrypt), not the oldenable passwordor type 7. - Keep configuration backups off the device, for example with the archive feature or a tool like Oxidized.
Real-world example: the forgotten branch router
A company bought a small business and found a router in its cabinet with no known passwords and no documentation. An engineer visited with a console cable, used the 0x2142 method, copied the old configuration in, and set new credentials connected to the company's TACACS+ server. The whole job took 20 minutes and the existing VPN tunnels came back unchanged.
Practice
Which configuration register value makes a Cisco router ignore its startup configuration?
During recovery, which way should you copy the configuration and why?
copy startup-config running-config, so the saved configuration is loaded without being overwritten.What does no service password-recovery do when someone tries the recovery procedure?
Key takeaways
- Password recovery needs console access and a reload, so physical security matters.
- Routers use confreg 0x2142; switches use the Mode button and ROMMON.
- Copy startup to running, set new passwords, then restore 0x2102 and save.
- AAA, strong hashing and off-device backups reduce the need for recovery.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.