In case if you forgot the password of Cisco Router, its very easy to recover it. I recently got into an issue where i could not remember the enable password or enable secret set on the Cisco Router. I had to go into the Recovery Mode and through password recovery procedure was able to recover it successfully.
Related: How to Recover Password of Cisco Switch 2960 (Step-by-Step Guide)
The Procedure I am showing you is from Cisco Router 4331 ISR but it should work on other Cisco Routers as well. Please note that the Router will be out of business during this process as it needs to be rebooted. Therefore, Please plan it accordingly. I used Putty throughout the recovery procedure, you can use any other terminal application as well.
- Reboot the Cisco Router and break the boot sequence by using Break Option in Putty through Special Command -> Break as shown in below screenshot:

- Once the boot sequence is interrupted, You will see rommon 1 > prompt. Type ? and enter, you will then be able to see the list of commands you can use on this prompt. The one we are interested in is confreg

- The trick is to bypass the startup-config which contains all the passwords. Type the confreg on the console and press enter. You will see that the current configuration register value is 0x2102. We need to set it to 0x2142.

- Set the confreg value to 0x2142

- Reset the cisco router which will restart bypassing the startup-config


- Now you can see that Router> Prompt which started with Empty Configuration

- Use en to go to the enable / privilege mode

- Now as you already have configuration in startup-config. Copy startup-config to running-config so that you do not lose it. You can see that the Router Name has been changed which was saved in my startup-config. Go to the
Conf t
mode and update the Router Passwords and then Change the config-register value back to 0x2102 when you are done. Please make sure to save everything before rebooting the router. You can use write mem as well to save the startup-config to running-config.

- Change the Config-Register Value to 0x2102 which was its original value and save the config using write mem and then restart the router.

That’s it, Once the Router has been rebooted it will work as per the configuration on the Startup-configuration which you have tweaked through this recovery procedure by removing / updating the passwords.