Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

Recover a Root Password

date_range 06-Nov-24

If you forget the root password, you can use the password recovery procedure to reset the root password.

How to Recover the Root Password for Junos OS Evolved

This procedure resets the root password without resetting the device configuration to the factory default configuration. Only the root password is reset. This procedure does not affect the device state or any other function.

Video 1: How to Recover the Root Password in Junos OS Evolved

How to Connect to the Serial Port

The first task in the password reset operation is to connect to the serial port of the device.

To connect to the serial port:

  1. Power off the router by pressing the power button on the front panel.
  2. Turn off the power to the management device (usually a computer) that you will use to access the CLI.
  3. Plug one end of the Ethernet rollover cable supplied with the router into the RJ-45 to DB-9 serial port adapter supplied with the router.
  4. Plug the RJ-45 to DB-9 serial port adapter into the serial port on the management device.
  5. Connect the other end of the Ethernet rollover cable to the console port on the router.
  6. Turn on the power to the management device.
  7. On the management device, start your asynchronous terminal emulation application (such as Microsoft Windows Hyperterminal), and select the appropriate COM port to use (for example, COM1).
  8. Configure the port settings as follows:
    • Bits per second: 9600

    • Data bits: 8

    • Parity: None

    • Stop bits: 1

    • Flow control: None

  9. Power on the router by pressing the power button on the front panel.

    Verify that the POWER LED on the front panel turns green. The terminal emulation screen on your management device displays the router’s boot sequence.

How to Recover the Root Password

The password reset operation is triggered early in the boot process. You reset the password in the shell.

To recover the root password:

  1. Do a hard reboot of the Routing Engine (that is, shut down the OS, power off the device, and then power on the device).

    On the terminal, you will see the following screen:

    content_copy zoom_out_map
     GNU GRUB  version 2.02~beta3
    
     +--------------------------------------------------------------------+
     |*Primary ptx-fixed-19.1-16                                          | 
     | Primary [Recover password]                                         |
     | Primary-Rollback ptx-fixed-19.1-15                                 |
     | Primary-Rollback [Recover password]                                |
     |                                                                    |
     |                                                                    |
     |                                                                    |
     |                                                                    |
     |                                                                    |
     |                                                                    |
     |                                                                    |
     |                                                                    | 
     +--------------------------------------------------------------------+
    
          Use the ^ and v keys to select which entry is highlighted.          
          Press enter to boot the selected OS, `e' to edit the commands       
          before booting or `c' for a command-line.                    
  2. Use the arrow keys to scroll down to the Primary [Recover password] option, and press Enter.
    content_copy zoom_out_map
    Disk boot ...
    IMA is 0
    Loading kernel ...ok.
    Loading initrd ...ok.
    Booting ...
    [    0.791088] Failed to find cpu0 device node
    Processing /dev/sda2 for mount on /soft ...[checking]..ok [mounting]..done
    Processing /dev/sda5 for mount on /data ...[checking]..ok [mounting]..done
    Processing /dev/sda6 for mount on /data/config ...[checking]..ok [mounting]..done
    Processing /dev/sda7 for mount on /data/var ...[checking]..ok [mounting]..done
    mkswap: /dev/sda3: warning: wiping old swap signature.
    Setting up swapspace version 1, size = 4 GiB (4294963200 bytes)
    no label, UUID=7d905478-773b-41e5-8f1d-8166ec03f93a
    Processing /dev/sda1 for mount on /boot ...[checking]..ok [mounting]..done
    Done with local filesystems setup.
    Mounting version junos-linux-install-ptx-x86-64-16.2I20180502181332_evo-builder...done.
    System is running with minimal count of software versions
    modprobe: FATAL: Module jnx_cbd_fpga_ptx21k not found in directory /lib/modules/4.8.24-WR2.2.1_standard
    Installing kexec kernel...Cannot get kernel page_offset_base symbol address
    done
    Password recovery in progress. Please enter new password.
    
  3. Enter the new password, and then retype the new password and press Enter.
    content_copy zoom_out_map
    New password: 
    Retype new password: 
    passwd: password updated successfully
    Password recovery done
    
    Welcome to Linux!

    The reboot proceeds until the login prompt appears.

    content_copy zoom_out_map
    [  OK  ] Started Serial Getty on ttyS0.
    [  OK  ] Reached target Login Prompts.
    [  OK  ] Started Vsftpd ftp daemon.
    [  OK  ] Started Network Time Service.
    [  OK  ] Started strongSwan IPsec IKEv1/IKEv2 daemon using swanctl.
    [  OK  ] Started Arp filtering arptables.
    [  OK  ] Started Management Ethernet Interface Manager Service.
    [  OK  ] Started OFP on RE.
             Starting MGD initialization of schema and database on RE...
    
    Juniper Linux Distribution 2.2.1 re0 ttyS0
    
    re0 login: 
  4. At the prompt, log in as root using new password.

    You will see a shell prompt.

    content_copy zoom_out_map
    Last login: Mon May  7 13:09:08 PDT 2018 from xxxx
    --- JUNOS builder Linux re0 4.8.24-WR2.2.1_standard #1 SMP PREEMPT Mon Apr 9 13:21:32 PDT 2018 x86_64 x86_64 x86_64 GNU/Linux
    root@RE0:~# 
  5. To start the CLI, enter cli.
footer-navigation