Operational Monitoring and Maintenance · Topic 4 of 4
Power, Shutdown and Root Password Recovery
Learn to power on, halt, power off and reboot Junos devices safely, and the console steps to recover a lost root password, for JNCIA-Junos JN0-106.
- 5 min
- Always shut down from the CLI:
request system reboot,haltorpower-off. haltstops the software with power still on;power-offturns power off.- Console default: 9600 baud, 8 data bits, no parity, 1 stop bit, no flow control.
What it is
A Junos device runs a full operating system with a file system on its Routing Engine. Like a server, it must be shut down gracefully with a CLI command before you remove power, or the file system can be damaged.
Root password recovery is the procedure for setting a new root password when nobody knows the old one. It needs physical console access and a reboot into single-user mode, so it cannot be done over the network.
How it works
Powering on
Connect a console cable before you power on, so you can watch the boot. The Junos console port defaults to 9600 baud, 8 data bits, no parity, 1 stop bit and no flow control.
Turn on the power. The device runs its boot loader, loads the Junos OS kernel, starts the daemons and then shows a login prompt. A device in its factory-default state accepts the user root with no password.
When root logs in, it starts in the UNIX shell, not the CLI. Type cli to start the Junos CLI. Other user accounts go straight into the CLI.
Shutting down and restarting
| Command | Effect |
|---|---|
request system reboot | Shuts the software down cleanly and restarts the device |
request system halt | Shuts the software down cleanly and stops; the device stays powered |
request system power-off | Shuts the software down cleanly and powers the device off |
After request system halt, the device does nothing until you restart it from the console or cycle the power. After request system power-off, you power it on again with the power switch or by cycling the power.
Each command asks for confirmation and accepts options:
user@router> request system reboot at 23:00
user@router> request system reboot in 10
user@router> request system halt message "Maintenance: device going down"
at schedules the action for a time, in delays it by a number of minutes and message sends a note to logged-in users. On a device with two Routing Engines, both-routing-engines acts on both.
Never just pull the power cable from a running Junos device. Halt it or power it off from the CLI first and wait for the console to show that the system has stopped, or you risk file system corruption.
Root password recovery
You need a console connection and physical access. The procedure resets only the root password; the rest of the configuration is kept.
The classic procedure on FreeBSD-based Junos platforms:
- Connect to the console port and reboot or power cycle the device.
- When the loader prompts "Hit [Enter] to boot immediately, or space bar for command prompt.", press the space bar.
- At the
loader>prompt, typeboot -sto start in single-user mode. - When asked for a shell or
recovery, typerecovery. Junos OS starts the CLI in recovery mode at aroot>prompt. - Set a new root password and commit:
root> configure
root# set system root-authentication plain-text-password
New password:
Retype new password:
root# commit
root# exit
root> exit
- Confirm the reboot when asked. The device boots normally and the new root password is active.
Some newer platforms show a boot menu instead of the loader prompt. There you choose the single-user option from the menu and then continue with recovery as above.
Blocking recovery from the console
Anyone with physical console access can use this procedure. To stop that, mark the console as insecure:
user@router# set system ports console insecure
With this setting, single-user mode asks for the existing root password, so the recovery procedure no longer bypasses it. Use it only when you have a secure record of the root password.
A worked example
An engineer inherits a router and nobody knows its root password. The engineer connects a laptop to the console at 9600 baud and enters request system reboot from a working admin account, or power cycles the router if no account works.
At the loader prompt the engineer presses the space bar, types boot -s, then recovery. In the CLI they set a new password with set system root-authentication plain-text-password, commit, exit and let the router reboot. The routing and interface configuration is unchanged.
How the exam asks about this
- "Which command stops Junos OS but leaves the device powered on?" →
request system halt. - "What access do you need to recover the root password?" → Physical console access.
- "Which command stops console users from recovering the root password?" →
set system ports console insecure.
Common mistakes
Confusing halt and power-off. request system halt stops the software but leaves power on. request system power-off turns the device off.
Thinking root recovery erases the configuration. It changes only the root password. Everything else stays as it was.
Trying root recovery over SSH. The procedure needs the boot loader and single-user mode, which you reach only from the console.
What to remember for the exam
- Always shut down from the CLI:
request system reboot,haltorpower-off. haltstops the software with power still on;power-offturns power off.- Console default: 9600 baud, 8 data bits, no parity, 1 stop bit, no flow control.
- Root recovery: console, interrupt the boot,
boot -s, typerecovery, setroot-authentication, commit, reboot. set system ports console insecureprevents root password recovery from the console.
The keyword in the root recovery procedure is recovery, typed at the single-user prompt. It starts the CLI so you can set the password with a normal commit.
Check yourself
Which command shuts down the software and turns the device off?
request system power-off.At the
loader>prompt, which command starts single-user mode for root password recovery?boot -s, after which you typerecoveryto start the CLI.What does
set system ports console insecuredo?It makes single-user mode ask for the root password, which blocks root password recovery from the console.
Topic 4 of 4 in Operational Monitoring and Maintenance
Test yourself on Operational Monitoring and Maintenance
The full Juniper JNCIA-Junos JN0-106 question bank has 1,155 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.