How to reset Cisco 2960 switch password without losing your configuration
To reset your Cisco 2960 password, connect your console cable to the switch and open up your terminal emulator software, you can use minicom if you are using Linux. Please visit this link on how to install and configure minicom using in Fedora/Red Hat/CentOS and this link if you are using Debian/Ubuntu.
Power on the switch while holding the mode button. Release the mode button after you see the screen below in your terminal emulator software.
Boot Sector Filesystem (bs) installed, fsid: 2 Base ethernet MAC Address: 1c:1d:86:db:c8:80 Xmodem file system is available. The password-recovery mechanism is enabled. The system has been interrupted prior to initializing the flash filesystem. The following commands will initialize the flash filesystem, and finish loading the operating system software: flash_init boot switch:
Initialize the flash file system using the below command.
Initializing Flash... flashfs: 542 files, 19 directories flashfs: 0 orphaned files, 0 orphaned directories flashfs: Total bytes: 32514048 flashfs: Bytes used: 13520384 flashfs: Bytes available: 18993664 flashfs: flashfs fsck took 11 seconds. ...done Initializing Flash. switch:
Find the config file in flash: directory
The files that we are looking for in the flash: directory is the config.text file.
Directory of flash:/ 3 -rwx 2296
vlan.dat 4 -rwx 3569 config.text 5 -rwx 5 private-config.text 6 drwx 192 c2960-lanbasek9-mz.122-55.SE7 562 -rwx 2072 multiple-fs
Rename the config file so that it will not be loaded when we boot to the switch.
Then type the below command to boot to the switch
After booting, the switch will ask you to enter the "initial configuration dialog" to initially configure the switch using interactive CLI mode. Just type the word "no" because we are not re-configuring the switch.
--- System Configuration Dialog --- Enable secret warning ---------------------------------- In order to access the device manager, an enable secret is required If you enter the initial configuration dialog, you will be prompted for the enable secret If you choose not to enter the intial configuration dialog, or if you exit setup without setting the enable secret, please set an enable secret using the following CLI in configuration mode- enable secret 0
---------------------------------- Would you like to enter the initial configuration dialog? [yes/no]: no
At the switch prompt type en to enter enable mode.
Rename the configuration file to its original filename.
Copy the configuration file into the memory
Now that the config is loaded in to the memory, we can start changing the password.
enable secret newpassword
After changing the password, save the config and done.
This tutorial will also work on Cisco 2950 switches. Hope this helps.