21 agosto 2014

Resetting the root password in OpenWrt

I recently fired up one of my wireless routers(a Linksys WRT54GL already running OpenWrt) that I had not used in a while and needed to make some changes to the configuration. Unfortunately, I had forgotten the password so I could not SSH in or use the web interface. Since this seems like a common problem I decided to create this post covering resetting the root password in OpenWrt. The procedure to reset the root password is listed as a step by step process below.

    Step 1 – Disconnect power to the router and connect your computer to one of the switch ports on the router. NOTE: For the rest of this tutorial I will assume that the router is but this may change based on your configuration. Replace with the IP of the router if yours has a different IP.
    Step 2 – Give your computer a static IP. In my case I used an IP of and a subnet mask of You can do this with:

    sudo ifconfig eth0 netmask

    You do not need to set the gateway or DNS information.
    Step 3 – Boot the router in failsafe mode by doing the following:
        Connect power to the router.
        Wait for the DMZ light(this might be a different light on other brands of routers) to come on and then hit the “Reset” button.
        If the above operation worked, the DMZ and power lights will both be blinking indicating that the router is in failsafe mode.
    Step 4 – Now that the router is in failsafe mode, connect to the router using:


    If you are successfully connected, you should see the following screen:

    BusyBox v1.11.2 (2009-12-02 06:19:32 UTC) built-in shell (ash)
    Enter 'help' for a list of built-in commands.

      _______                     ________        __
     |       |.-----.-----.-----.|  |  |  |.----.|  |_
     |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
     |_______||   __|_____|__|__||________||__|  |____|
              |__| W I R E L E S S   F R E E D O M
     KAMIKAZE (8.09.2, r18961) -------------------------
      * 10 oz Vodka       Shake well with ice and strain
      * 10 oz Triple sec  mixture into 10 shot glasses.
      * 10 oz lime juice  Salute!

    Step 5 – You are now connected to the router but you cannot yet change the root password because the JFFS is still in read only(RO) mode. To change the JFFS to read-write(RW) mode use the command


    and the JFFS will be remounted in RW mode.
    Step 6 – Now you can change the root password using by issuing the command:


    and entering your new root password twice. After entering the password, reboot the router and you should be able to log in to the router using

    ssh root@

    and entering the password you just set in the telnet session.

Hopefully this post includes all the information you will need to reset the root password on your OpenWrt installation. Please let me know if there are any issues with the instructions and ask any questions you might have in the comments.

Tomado de: http://karsmic.wordpress.com/2010/05/05/resetting-the-root-password-in-openwrt/

No hay comentarios: