Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Configuring the Root Password

    Junos OS is preinstalled on the router. When the router is powered on, it is ready to be configured. Initially, you log in as the user root with no password. The root account or user is a predefined user name in Junos OS. The root user is by default the administrator or superuser, who has absolute permission to both configure and install software on a device. Junos OS requires configuration of the root password before it accepts a commit operation. On a new device, the root password must always be a part of the configuration submitted with your initial commit.

    To set the root password, you have several options: enter a clear-text password that Junos OS encrypts, enter a password that is already encrypted, or enter a secure shell (ssh) public key string.

    Optionally, instead of configuring the root password at the [edit system] hierarchy level, you can use a configuration group, as shown in this procedure. This is a recommended best practice for configuring the root password. This procedure uses a group called global as an example.

    To set the root password:

    1. Use one of the following methods to configure the root password.
      • To enter a clear-text password that the system encrypts for you, use the following command to set the root password:
        [edit groups global system]root@# set root-authentication plain-text-password New Password: type password hereRetype new password: retype password here

        If you use a clear-text password, Junos OS displays the password as an encrypted string so that users viewing the configuration cannot see it. As you enter the password in plain text, Junos OS encrypts it immediately. You do not have to configure Junos OS to encrypt the password as in some other systems. Plain-text passwords are hidden and marked as ## SECRET-DATA in the configuration.

      • To enter a password that is already encrypted, use the following command to set the root password:

        Caution: Do not use the encrypted-password option unless the password is already encrypted, and you are entering the encrypted version of the password.

        If you accidentally configure the encrypted-password option with a clear-text password or with blank quotation marks (" "), you will not be able to log in to the device as root, and you will need to complete the root password recovery process.

        [edit groups global system]root@# set root-authentication encrypted-password password
      • To enter an SSH public string, use the following command to set the root password:
        [edit groups global system]root@# set root-authentication (ssh-dsa | ssh-ecdsa | ssh-rsakey
    2. (Optional) Strengthen security by only allowing root access from the console port.
      [edit groups global system]root@# set services ssh root-login deny
    3. If you used a configuration group, apply the configuration group, substituting global with the appropriate group name.
      [edit]user@host# set apply-groups global
    4. Commit the changes.
      root@# commit

    Published: 2013-10-28