username

Configures user along with role for local authentication.

Syntax

username username role role password password [ encryption-level 0 | 10 ]
no username username

Parameters

username
Specifies the user name. The username supports 1-40 characters. Characters allowed are alpha-numeric, underscore and dot. Underscore is not allowed as the first character.
role
Specifies the pre-defined role to be assigned to the user. The supported roles are admin and user.
The role supports 4-32 characters. Characters allowed are alpha-numeric, underscore and dot. Underscore is not allowed as the first character.
password
Specifies the password of the user. Supported length of the plain text password is 8-40 and 8-128 for hashed passwords.
encryption-level 0 | 10
Specifies whether the password input is encrypted. The values 0 and 10 indicate clear-text and encryption. The default value is 0.

Modes

Config mode

Usage Guidelines

This command is available only to users with admin role.

Table 1. Error messages
Error message Reason
Username validation error Username length should be between 1 and 40 characters.

Username should contain only alpha-numeric, underscore and period.

Username first letter is neither alpha-numeric nor an underscore.

Role validation error Role does not exist.
Password validation error Password has a bad length/size. 

Examples

The following example configures users with admin and user roles.

NPB# configure terminal 
NPB(config)# username testuser1 role admin password password123 encryption-level 0 
NPB(config)# username testuser2 role user password $6$salt$cevuzTZ/QBjzuZG0/ebEeedmcTnhyM8ITUu8K032Cp2XvIibq7voqYagm18bwpLBqrg/l/l6YxTmKKibJz5r10 encryption-level 10 

NPB# show running-config username 
username testuser1 role admin password $6$salt$cevuzTZ/QBjzuZG0/ebEeedmcTnhyM8ITUu8K032Cp2XvIibq7voqYagm18bwpLBqrg/l/l6YxTmKKibJz5r10 encryption-level 10 
username testuser2 role user password $6$salt$cevuzTZ/QBjzuZG0/ebEeedmcTnhyM8ITUu8K032Cp2XvIibq7voqYagm18bwpLBqrg/l/l6YxTmKKibJz5r10 encryption-level 10