Configure User Accounts
User accounts provide one way for users to access the router. (Users can access the router without accounts if you configured RADIUS or TACACS+ servers, as described in User Authentication.) For each account, you define the login name for the user and, optionally, information that identifies the user. After you have created an account, the software creates a home directory for the user.
To create user accounts, include the
userstatement at the[edit system login]hierarchy level:[edit system]login {useruser-name{full-namecomplete-name;uiduid-value;classclass-name;authentication {(encrypted-password "password" | plain-text-password);ssh-rsa "public-key";ssh-dsa "public-key";}}}For each user account, you can define the following:
- User name—(Optional) Name that identifies the user. It must be unique within the router. Do not include spaces, colons, or commas in the user name.
- User's full name—(Optional) If the full name contains spaces, enclose it in quotation marks. Do not include colons or commas.
- User identifier (UID)—(Optional) Numeric identifier that is associated with the user account name. The identifier must be in the range 100 through 64000 and must be unique within the router. If you do not assign a UID to a user name, the software assigns one when you commit the configuration, preferring the lowest available number.
You must ensure that the UID is unique. However, it is possible to assign the same UID to different users. If you do this, the CLI displays a warning when you commit the configuration, then assigns the duplicate UID.
- User's access privilege—(Required) One of the login classes you defined in the
classstatement at the[edit system login]hierarchy level or one of the default classes listed in Table 12, "Default System Login Classes" .- Authentication method or methods and passwords that the user can use to access the router—(Optional) You can use ssh or an MD5 password, or you can enter a plain-text password that the JUNOS software encrypts using MD5-style encryption before entering it in the password database. For each method, you can specify the user's password. If you configure the
plain-text-passwordoption, you are prompted to enter and confirm the password:[edit system]user@host#set root-authentication plain-text-passwordNew password:type password hereRetype new password:retype password hereFor information about how to create plain-text passwords, see Plain-Text Passwords.
For ssh authentication, you can copy the contents of an ssh keys file into the configuration. For information about how to specify filenames, see Specify Filenames and URLs.
To load an ssh key file, use the
load-key-filecommand. This command loads RSA (ssh version 1) and DSA (ssh version 2) public keys. You can also configure a user to use ssh-rsa and ssh-dsa keys.If you load the ssh keys file, the contents of the file are copied into the configuration immediately after you enter the
load-key-filestatement. To view the ssh keys entries, use the configuration modeshowcommand. For example:[edit system]user@host#set root-authentication load-key-file my-host:.ssh/identity.pub.file.19692 | 0 KB | 0.3 kB/s | ETA: 00:00:00 | 100%[edit system]user@host#showroot-authentication {ssh-rsa "1024 35 9727638204084251055468226757249864241630322207404 962528390382038690141584534964170019610608358722961563475784918 273603361276441874265946893207739108344810126831259577226254616 679992783161235004386609158662838224897467326056611921814895398 139655615637862119403276878065381696020274916416373591326939634 4008443 boojum@juniper.net"; # SECRET-DATA}An account for the user
rootis always present in the configuration. You configure the password forrootusing theroot-authenticationstatement, as described in Configure the Root Password.Example: Configure User Accounts
Create accounts for four router users, and create an account for the template user "remote." All users use one of the default system login classes.
[edit]system {login {user philip {full-name "Philip of Macedonia";uid 1001;class superuser;authentication {encrypted-password "$1$poPPeY";}}user alexander {full-name "Alexander the Great";uid 1002;class view;authentication {encrypted-password "$1$14c5.$sBopasdFFdssdfFFdsdfs0";ssh-dsa "8924 37 5678 5678@gaugamela.per";}}user darius {full-name "Darius King of Persia";uid 1003;class operator;authentication {ssh-rsa "1024 37 12341234@ecbatana.per";}}user anonymous {class unauthorized;}user remote {full-name "All remote users";uid 9999;class read-only;}}}