Cisco Switch Password Recovery | Your Step-by-Step Guide
Introduction
It happens to the best of us: you’re locked out of a Cisco switch and can’t remember the password. Don’t worry! This guide provides a clear, step-by-step process to regain access.
Note: This procedure requires physical access to the switch and a brief period of network downtime.
Prerequisites
Before you begin, make sure you have the following:
- A computer with a serial port or USB-to-serial adapter.
- A console cable (usually a light blue rollover cable).
- Terminal emulation software, such as PuTTY or Tera Term.
- Physical access to the switch.
Step-by-Step Password Recovery Process
Step 1: Connect and Enter ROMMON Mode
First, connect your computer to the switch’s console port. Power cycle the switch by unplugging and replugging the power cord.
Within 15 seconds of the switch powering on, press and hold the Mode button on the front of the switch. Release it when the SYST LED blinks amber and then turns solid green. You will be at the switch: prompt, which is ROMMON mode.
Step 2: Initialize the Flash File System
At the switch: prompt, you need to initialize the flash file system. This allows you to see and manage the files stored on the switch.
switch: flash_init
Step 3: Rename the Configuration File
To bypass the existing password, we will rename the configuration file. This forces the switch to boot without loading the startup configuration.
switch: rename flash:config.text flash:config.text.old
You can verify the file was renamed by using the dir flash: command.
Step 4: Boot the Switch
Now, boot the system from flash. The switch will load the IOS image but skip the configuration file you just renamed.
switch: boot
The switch will boot up and present you with the initial configuration dialog.
Step 5: Access Privileged EXEC Mode
When prompted to enter the initial configuration dialog, type no and press Enter.
--- System Configuration Dialog ---
Would you like to enter the initial configuration dialog? [yes/no]: no
You will now be at the user EXEC prompt (Switch>). Enter privileged EXEC mode.
Switch> enable
Switch#
Step 6: Restore Your Configuration
Now that you have privileged access, rename the configuration file back to its original name so you don’t lose your settings.
Switch# rename flash:config.text.old flash:config.text
Step 7: Load the Configuration into Memory
Copy the restored configuration file from flash into the switch’s running memory. This will restore all your previous settings, except for the password you’re about to change.
Switch# copy flash:config.text system:running-config
Press Enter when prompted for the destination filename.
Step 8: Set a New Password
With your old configuration loaded, you can now set a new password. Enter global configuration mode to make changes.
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# enable secret YOUR_NEW_STRONG_PASSWORD
Switch(config)# end
This command sets the privileged EXEC mode password. You can also change user-specific passwords here if needed.
Step 9: Save Your New Configuration
This is the most critical step! You must save the running configuration (with the new password) to the startup configuration file. Otherwise, all changes will be lost on the next reboot.
Switch# copy running-config startup-config
Press Enter to confirm. Your password has now been successfully reset!
