Issue the break sequence within 60 seconds of power up to put the router into ROMmon.
Type “confreg 0x2142” at the rommon 1> prompt. (This changes the default configuration register and causes the router to bypass the startup configuration where the forgotten enable password is stored.The configuration register is usually set to 0x2102 or 0x102)
Type no after each setup question, or press Ctrl-C to skip the initial setup procedure.
Router> enable
Router#copy start run
Now, change the passwords and give no shutdown commands to interfaces
R1(config)# config-register 0x2102 (To make the startup configuration effective while next booting)