.
.

Pasword recovery procedure on a Switch

Start by connecting to do console port with a PC

Host1 C:\# ping 192.168.1.2
 
To regain access to the switch, you need to do password recovery. Start by connecting to do console port with a PC.
When all hardware is ready, turn OFF power to the switch.
Turn the power BACK ON, while holding down the mode button. Release the MODE button when the LED over port 1 goes out. 

Host1 C:\# NEXT. 
Host1 C:\#flash_init (command to start the procedure of returning the password)
Host1 C:\#load_helper  (loading help)
Host1 C:\#dir flash:  (read the directory structure Flash)
Switch#rename flash:config.text flash:config.old (renaming files config.text in config.old)
Switch#boot (reboot switch)
……………… after reboot switch appears a lot of these characters ############################### and the name of the BIN file.
Towards the end of starts as Switch you can see the question:
Continue with configuration dialog? [yes/no] N  (enter 'N' for 'NO')

Switch#rename flash:config.old flash:config.text (renaming files config.old in config.text)

Switch#enable (go to User Exec mode)

Switch#copy flash:config.text system:running-config (copy config.text the currently running configuration running-config)

Destination file name [running-config]? running-config ili ENTER (destination file)

Switch#configure terminal (entry in global configuration mode)

Switch(config)#no enable secret (deleting a password that was entered as SECRET)

Switch(config)#enable password cisco (setting a new password cisco)
Switch(config)#enable secret class (setting a new password console line)


Switch(config)#line console 0 (entry in config mode for the console connected, PC-to-switch)
Switch(config-line)#password cisco (setting password cisco)
Switch(config-line)#exit
Switch(config)#line vty 0 15 (entry in config mode for TELNET connection)
Switch(config-line)#password cisco (setting password cisco)
Switch(config-line)#exit
Switch(config)#exit
Switch#copy running-config startup-config (save the currently running configuration in NVRAM)


Figure 1.

Pasword recovery procedure on a Cisco Switch 2900 serie