JunOS : How to reset root password

By | December 12, 2014

The following procedure is about reseting root password and preserve the current configuration on your Juniper device running JunOS.

1. As soon you see “Hit [Enter] to boot immediately, or space bar for command prompt.” message, just press the space bar as indicated :

FreeBSD/PowerPC U-Boot bootstrap loader, Revision 2.1
(marcelm@apg-bbuild01.juniper.net, Wed Feb 6 11:23:55 PST 2008)
Memory: 1024MB
Loading /boot/defaults/loader.conf
/kernel data=0x8d8e8c+0x947cc syms=[0x4+0x7a1a0+0x4+0xad2a2]
Hit [Enter] to boot immediately, or space bar for command prompt.
Booting [/kernel] in 1 second…

Type ‘?’ for a list of commands, ‘help’ for more detailed help.

2. At the prompt, enter “boot -s” command :

loader> boot -s

OUTPUT :

[...]
Trying to mount root from ufs:/dev/da0s2a
Attaching /packages/jbase via /dev/mdctl...
Mounted jbase package on /dev/md0...
System watchdog timer disabled
Enter full pathname of shell or 'recovery' for root password recovery or RETURN for /bin/sh: recovery

NOTE: Once in the CLI, you will need to enter configuration mode using
NOTE: the 'configure' command to make any required changes. For example,
NOTE: to reset the root password, type:
NOTE: configure
NOTE: set system root-authentication plain-text-password
NOTE: (enter the new password when asked)
NOTE: commit
NOTE: exit
NOTE: exit
NOTE: When you exit the CLI, you will be asked if you want to reboot
NOTE: the system

Starting CLI ...
{linecard:0}

3. Enter in configuration mode using “configure” command :

root> configure
Entering configuration mode

{linecard:0}[edit]

4. Enter command “set system root-authentication plain-text-password” to set a new JunOS root password :

root# set system root-authentication plain-text-password
New password:
Retype new password:

{linecard:0}[edit]

5. Commit the changes :

root# commit

fpc0:
commit complete

{linecard:0}[edit]

6. Exit the configuration and exec modes and reboot the system as followed :

root# exit
Exiting configuration mode

{linecard:0}
root> exit

Reboot the system? [y/n] y