How to reset password on OpenWrt

I have to admin that. I forgot password to my router. It is very shameful. When I updated router to latest version of OpenWrt I decided to change password. And I was carefully preparing this update and as result, I did not login to my router after that because everything working just fine. And today, more than month from setting it up I decided to check something. And I realized that I simply forgot password. It was new password that I never used before and I forgot it.

It is my main router, and I can reset router to factory default, but it will be pain to setup it again. As last resort I decided to search internet and found really simple way to reset password.

Links are here https://openwrt.org/docs/guide-user/troubleshooting/failsafe_and_factory_reset and https://openwrt.org/docs/guide-user/troubleshooting/root_password_reset but I will provide way to do this.

Firstly, you have to plug your router to computer via ethernet cable.

Next step change IP address of your computer to 192.168.1.1, mask to 255.255.255.0 and Default Gateway to 192.168.1.1. I am not sure, if there is need in Default Gateway, but I did, and it worked.

Next, restart your router and every second slowly press and release WPS/Wi-Fi On/Off button that located on left back side of router just before leftmost antenna. It is only button except power button. For other routers I believe this button called WPS. If you do it correctly after some time you will see that power LED will start blinking really fast. It means that you done everything correctly. There should be only one light. If you see more, probably you miss opportunity to press that button. Try to press it more often.

Next, check that ping 192.168.1.1 works and there is response. If you see PING: transmit failed. General failure then you probably did not configure static IP address correctly. Run ipconfig and make sure that it is displayed 192.168.1.1. If you see timeout, then probably you miss opportunity to press that button.

After that start SSH client:
putty root@192.168.1.1

Then execute command mount_root and then execute passwd command and will allow you to enter new password. Then restart router by using reboot -f command. Whole session should look like this:

root@(none):~# mount_root
switching to jffs2 overlay
root@(none):/rom/root# passwd
Changing password for root
New password:
Retype password:
passwd: password for root changed by root
root@(none):/rom/root# reboot -f

After that put router back where it was, revert changes to IP address, so it will receive address dynamically and everything should be back to normal.

And this helpful not only to changing passwords but also for situations when you did mess up with settings and would like to change them.

I really happy that OpenWrt implemented this feature as it saved me a lot of time.

I hope it will help someone.

Comments

Post comment