What if you have forgot the administrator password of the Cisco 2960 Switch and you try real hard to remember it and type the passwords but none of them work. This post will come to the rescue when you will have to recover the password without losing the running configuration.
1) Connect your console cable to the switch and open the terminal emulator software e.g. Putty on the machine (as shown below). Please make sure the correct COM Port is mentioned in the Serial Line box below. You can check the COM Port of your laptop / desktop (where you have connected the Serial Cable) through Device Manager. Keep the speed and other settings to default and click Open.
2) Once you click on Open, A Command Shell will open. As you do not have the password to logon to the switch. Keep the same console screen open and press and hold Mode button on the switch until you see switch: Prompt. It take approximately 20-25 seconds, but keep on holding the Mode button and you will then bunch of messages on the screen and finally switch: prompt.
3) There will be a line which says “The password-recovery mechanism is enabled.” (shown in below screenshot) before you see switch: prompt.
3.1) On the switch: prompt type flash_init to initialize the flash and the type dir flash: command to check the flash: drive. Please note the files which are showing as .renamed.
4. Type boot command on the Switch: Prompt as shown below. This will take some time to boot till you see System Configuration dialog and you will then see Switch> Prompt. Enter no in the system configuration dialog boxes.
Would you like to enter the initial configuration dialog ? [yes/no]: no
6. Type en on the Switch> Prompt to go to the privileged mode Switch# and then Type sh flash: command. You will see the files names with extension .renamed. We need to rename these files and remove .renamed from the file name. e.g. private-config.text.renamed will become private-config.text
6.1 Renaming the Files:
6.2 Confirming that .renamed has been removed from the file extensions using sh flash: command.
7. Copy config.text to running-config using copy flash:config.text running-config. Once you do that, you will notice that the switch name has been changed.
8. Go to Configuration mode using command conf t and run below highlighted commands. you can set the virtual terminal lines password as per your requirement and then reload the switch.
You can also go through the running configuration of this switch and update any configuration or remove enable password or create a login on the switch if you wish to and save the configuration before reloading the switch. If you have enable password or users created and as we do not know the passwords of those, in that case when you reload the switch, you will end up in the same situation where you are not able to logon to the switch and then you will have to follow the process again. So, Please make sure to go through the running configuration and once you are happy, save the configuration and reload the switch.
9. When the switch reloads and comes back online. You can use the passwords you configured in the running configuration in step 8.
That’s it! You have successfully reset the password of Cisco 2960 switch.
Summary of Commands Used in this Process (in Sequence)
Would you like to enter the initial configuration dialog? [yes/no]: no
Switch#rename flash:vlan.dat.renamed flash:vlan.dat
Switch#rename flash:config.text.renamed flash:config.text
Switch#rename flash:private-config.text.renamed flash:private-config.text
Switch#copy flash:config.text running-config
unknown08d09fa285c0(config)#enable secret class
unknown08d09fa285c0(config)#line console 0
unknown08d09fa285c0(config)#line vty 0 15
unknown08d09fa285c0(config)#copy running-config startup-config