Yesterday I did one stupid thing. Removed encoded root password from /etc/shadow on my router.


Router firmware is a openwrt like embeded linux with ssh access. Now I can't login with neither empty password nor old password. Is any way to restore password or is updating firmware will reset password ?

  • Is there another user on the system? Can you ssh in to that user and do sudo su to get to a root prompt and change the password from there? – etnguyen03 May 26 '18 at 1:24
  • No. Root is the only available user – vidima May 27 '18 at 20:28
  • Do you have access to modify the kernel command line arguments? (e.g: U-Boot) – Attie Aug 6 '18 at 12:19
  • No. I don't have. – vidima Aug 7 '18 at 17:49

There's a failsafe mode which can be used to reset the root password on OpenWrt. It brings the router up in logged-in-to-root state. This worked for me with OpenWrt Attitude Adjustment 12.09 when I didn't have the root pw on a TP-Link TL-WR841ND. Maybe it will work for you or others who come looking for this info:

  • Power cycle router
  • Wait for the DMZ light (second left -- only one on beside "power") start blinking -- the normal boot process
  • Hold router reset button for 2 seconds (light stops, then resumes blinking, rapidly)
  • Plug into router WAN port (failsafe unavail from LAN ports)
  • Set computer's IP addr to, netmask, GW (I was on a Mac, so did: sudo ifconfig en10 inet netmask My ethernet was on interface en10. The link at the top includes some info for Windows users, but I can't test this right now.)
  • telnet to It should connect, and give you a banner, drink recipe and root prompt.
  • mount_root to mount router’s filesystem in read/write mode
  • passwd to change root password

Now, you can reboot the router again, and try it out. Don't forget to change your computer's ethernet interface back to using DHCP (I did sudo ipconfig set en10 DHCP), and plug into a LAN port. Then you can visit the router at its normal address (mine was and login using the password you set.

| improve this answer | |

If there is a restore factory or reset available, it should take you back to default configuration (in most routers admin:admin)

| improve this answer | |
  • 1
    This answer is a stab in the dark and does not address the issue. – Attie Aug 6 '18 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.