You can change the privilege level of most commands by using the privilege command that is available in Global Configuration mode. To use this command, you must enable your CLI session to privilege level 15.
You can change privilege group accessibility. Privilege groups are no longer required to be hierarchical. You can modify the privilege group membership and define which privilege group is a member of another privilege group.
A privilege group can contain commands and other privilege groups as members. A group always has access to commands in its own privilege group and in privilege group 0. By default, all groups have one member and a specific privilege group has access to all commands in all privilege groups with a lower number than the specific group.
A privilege group is reachable from another privilege group when it is a member of that privilege group, or a member of a group that is a member of that privilege group until a search of all member groups is exhausted. This can go through several recursions as long as there are no circular dependencies.
Privilege group 0 is not a member of any group and you cannot assign member groups to it, but it is reachable from every privilege group.
Numbers in the range 0—15 identify the 16 privilege groups. Each of the 16 groups can have a name or an alias. The default internal name is the privilege group number. By default, the groups are hierarchical and each group, with the exception of groups 1 and 0, contains one group. When a group contains a group, the contained group is a member of the original group: privilege group p has one member, privilege group p-1. For example, privilege group 15 has member 14, privilege group 14 has member 13, and privilege group 2 has member 1.
For hierarchical groups, groups 0 through 14 are reachable from privilege group 15, groups 0 through 13 are reachable from privilege group 14, groups 0 to 4 are reachable from 5, and so forth. Hierarchical groups can also contain other privilege groups. For example, group A is reachable from group B if group A is a member of group B or is a member of a group that is a member of group B. If group X has member Y and Y has member Z then Z is reachable from X.
You cannot configure circular dependencies. For example, you cannot configure a circular dependency where group X has member Y, Y has member Z, Z has member P, and X can reach Z and P. Group X cannot have member Z or P because Z and P are reachable through Y.
In each of the following examples, privilege groups are at the default setting, where privilege group 0 is reachable from every privilege group, 15 contains 14, 14 contains 13, 13 contains 12, and so forth. The commands in each example change the privilege group settings from the default.
Example 1
- host1(config)#privilege-group membership clear
11
- host1(config)#privilege-group membership 15
add 10
In Example 1:
Example 2
- host1(config)#privilege-group membership 14
remove 13
In Example 2:
Example 3
- host1(config)#privilege-group membership clear
13
- host1(config)#privilege-group membership 13
add 10
In Example 3:
Example 4
- host1(config)#privilege-group membership 12
remove 11
- host1(config)#privilege-group membership 12
add 5
- host1(config)#privilege-group membership 11
add 5
In Example 4:
Example 5
- host1(config)#privilege-group membership clear
9 8 7
- host1(config)#privilege-group membership 7
add 1
- host1(config)#privilege-group membership 8
add 14
In Example 5:
Example 6
- host1(config)#privilege-group alias 13 LI
- host1(config)#privilege-group alias 10 dailyAdmin
- host1(config)#privilege-group alias 7 weekendAdmin
- host1(config)#privilege-group alias 6 dailyTroll
- host1(config)#privilege-group alias 5 basicUser
- host1(config)#privilege-group alias 0 minUser
- host1(config)#privilege-group alias 15 superUser
In Example 6, a number or name can specify the seven privilege groups 0, 5, 6, 7, 10, 13, and 15.
Example 7
- host1(config)#privilege-group membership clear
dailyAdmin
- host1(config)#privilege-group membership dailyAdmin
add dailyTroll
In Example 7, privilege group 10 alias dailyAdmin has one member: privilege group 6 alias dailyTroll.
Example 8
- host1(config)#no privilege-group membership 9
Example 8 reverts one privilege group membership to its default setting. Prior to the execution of this command, the following group memberships were in place:
|
group |
member |
reachable |
|---|---|---|
|
8 |
12 |
12,0 |
|
9 |
-- |
0 |
|
10 |
9 |
9,0 |
|
11 |
10 |
10,9,0 |
|
12 |
11 |
11,10,9,0 |
Reverting privilege group 9 to its default gives it one member: privilege group 8. This creates the circular dependency: 8 contains 12, 12 contains 11, 11 contains 10, 10 contains 9, and 9 contains 8.
Example 9
- host1(config)#no privilege-group membership
In Example 9, privilege group membership reverts to the default setting. All privilege groups revert to hierarchical settings: 15 contains 14, 14 contains 13, 13 contains 12, and so forth. Privilege group 0 is reachable from every privilege group.
Example 10
- host1(config)#no privilege-group membership
7
In this example, one privilege group membership reverts to its default setting. Privilege group 7 contains group 6.
Example 11
- host1(config)#no privilege-group alias
In Example 11, all alias settings are removed.
Example 12
host1#show privilege group
privilege privilege directly all
group group reachable reachable
alias groups groups *
---------- ---------- -------- -----------------
0 minUser -- --
1 -- -- 0
2 -- 1 0 1
3 -- 2 0 1 2
4 -- 3 0 1 2 3
5 basicUser 4 0 1 2 3 4
6 dailyTroll 5 0 1 2 3 4 5
7 weekendAdmin 1 0 1
8 -- 14 0 14
9 -- -- 0
10 dailyAdmin 6 0 1 2 3 4 5 6
11 -- 5 0 1 2 3 4 5
12 -- 5 0 1 2 3 4 5
13 LI 10 0 1 2 3 4 5 6 10
14 -- -- 0
15 superUser 10 14 0 1 2 3 4 5 6 10 14 15
*Privilege Group can reach itself
Example 12 shows privilege group overrides in effect.
Example 13
host1#show privilege group 15 superUser The following groups are directly reachable: 14 dailyAdmin
The following groups are reachable: 1 14 2 3 4 basicUser dailyAdmin dailyTroll minUser
In Example 13, groups 14 and dailyAdmin are directly reachable and groups 1, 14, 2, 3, 4, basicUser, dailyAdmin, dailyTroll, and minUser are reachable.
privilege
- host1(config)#privilege exec level 12 terminal
width
- host1(config)#privilege exec all level 5 terminal
![]() |
Note: You must access the CLI at privilege level 15 to view or use this command. |
privilege-group alias
- host1(config-if)#privilege-group alias
privilege-group membership
- host1(config-if)#privilege-group membership
privilege-group membership clear
- host1(config-if)#privilege-group membership
clear
Changing command privilege levels can be a powerful security tool. However, changing the command privilege for some commands could render the CLI unusable and require you to reboot the router. To eliminate this possibility, the CLI does not allow you to remap the following commands:
You cannot change the privilege level of keywords that are separated from the command string by a parameter in the command sequence. In other words, once the privilege algorithm reaches a parameter, the privilege algorithm that maps the commands to the desired privilege level stops and allows any keyword options that may follow in the command sequence. The algorithm then waits for a carriage return before looking at the next command sequence.
For example, you can change the command privilege level for the telnet command. However, because the telnet command is immediately followed by a variable (that is, a hostname or IP address) and not a keyword, you cannot change the privilege level for any keywords that follow the command.
- host1#telnet ?
- HOSTNAME or A.B.C.D The ip address of the remote system
- host1#telnet router2 ?
- <0 - 65535> The port on which to send the request
- bgp Border Gateway Protocol (179)
- chargen Character generator (19)
- cmd Remote commands (rcmd, 514)
The privilege command allows you to set command privilege levels for parts of commands that the CLI would normally consider ambiguous. In other words, you can set privilege levels by specifying letters that represent only the beginning part of a command or group of commands (even the first letter of a command or group of commands).
The following example sets the privilege level to 12 for any Exec mode (user or privileged) command that start with the letter “ t” :
- host1(config)#privilege exec level 12 t
The list of affected commands includes telnet, terminal, test, and traceroute.
The following example changes all the above commands, with the exception of the traceroute command, to level 15:
- host1(config)#privilege exec level 15 te
The following example changes all commands that start with the letters “ te” (for example, telnet, terminal, and test) and any second keyword that starts with the letter “ i” and follows a command that starts with the letters “ te” (for example, the keyword “ ip” in the command test ip) to level 1:
- host1(config)#privilege exec level 1 te i
When you enter an ambiguous command and an exact match of the command is found, partial matches are ignored and are not modified.
For example, the traffic-class and traffic-class-group commands are available in Global Configuration mode. If you issue the privilege configure level 5 traffic-class command, an exact match is made to traffic-class, and traffic-class-group is not modified.
If you want to set the privilege level for both traffic-class and traffic-class-group and you do not want the exact match to be made to traffic-class, issue a partial command such as traffic-c. The privilege level of all commands that begin with traffic-c is modified.
The privilege command allows you to set command privilege levels for no and default versions of commands. However, setting the privilege level for either the no or default versions of a command does not set the privilege level of the affirmative version of the command. This means that you can have the no or default version of a command at a different privilege level than its affirmative version
![]() |
Note: You can set the no or default command to a separate privilege level without specifying any other command to follow. This would force all commands that have a no or default version to function only for that privilege level and higher. For example, if you issue the privilege exec level 10 no command, all no versions in the Privileged Exec mode are available to users at level 10 and higher. |
.
The all keyword is a wildcard parameter that enables you to set privilege levels for multiple commands rather than setting them individually.
You can set the privilege level for all commands within a specified mode. This setting includes all commands in modes that you can access from a specified mode.
If the command specified in the privilege command changes the configuration mode, all commands in the configuration will also be set to the specified privilege level. For more information about accessing modes, see Accessing Command Modes.
For example, issuing the configure command in Privileged Exec mode changes the configuration mode to Global Configuration. If you issue the privilege exec all level 5 configure command, all commands in Global Configuration mode become accessible to users who have CLI privileges at level 5 and higher. For more information about user privilege levels, see Privileged-Level Access.
You can set the privilege level for a group of commands by using the beginning keyword in a command.
For example, if you issue the privilege configure all level 5 snmp command, all commands in Global Configuration mode that begin with snmp become accessible to users who have CLI privileges at level 5 and higher.
The effectiveness of a privilege level that is set with the all keyword depends on its precedence level in the CLI. A privilege level is considered to be in effect only if a privilege level that is configured at a higher precedence level does not override it.
The CLI uses the following order of precedence:
![]() |
Note: This order of precedence does not apply to privilege levels that are set without the all keyword. |
In the following example, the privilege level of the snmp-server community command is set to level 11, the privilege level for all commands that begin with snmp is set to level 10, and the privilege level for all commands in Global Configuration mode is set to level 5.
- host1(config)#privilege configure level 11
snmp-server community
- host1(config)#privilege configure all level
10 snmp
- host1(config)#privilege exec all level 5 configure
The following show configuration output displays the privilege levels set above. The privilege levels for the snmp-server community command and the snmp-server group of commands are still present in the output. However, the privilege level of Global Configuration mode takes precedence, and the privilege levels of the other commands are rendered ineffective. Users can access all snmp commands at level 5 or higher.
- host1#show config category management cli
command-privileges
- privilege configure level 11 snmp-server community
- privilege configure all level 10 snmp-server
- privilege exec all level 5 configure
Issuing the all keyword supersedes privilege levels that were previously set without the all keyword.
In the following example, the snmp-server-community command is set to level 7, and the snmp keyword is set to level 6. The privilege level of the snmp keyword does not override the snmp-server community setting, because both of these commands are set without the all keyword.
- host1(config)#privilege configure level 7
snmp-server community
- host1(config)#privilege configure level 6
snmp
All snmp commands are then changed to level 5 with the all keyword.
- host1(config)#privilege configure all level
5 snmp
The show configuration output displays all snmp commands at level 5, superseding the existing level 6 setting. The snmp-server community command is still present in the show configuration output, but it is ineffective.
- host1#show config category management cli
command-privileges
- privilege configure level 7 snmp-server community
- privilege configure all level 5 snmp-server
Using the no version or reset version removes the all keyword and restores default privilege levels.
If the privilege setting of the mode or command for which you are restoring default privilege levels takes precedence over any ineffective privilege settings, those settings will automatically take effect according to the order of precedence (see Using the Order of Precedence ).
The difference between the no version and the reset version is that the reset version removes the configuration from the show configuration output. This is useful when you want to remove a configuration that has been overridden and rendered ineffective by a privilege level that takes precedence.
The factory default privilege level for the console line and all vty lines is 1. However, you can use the privilege level command in Line Configuration mode to set the default login privilege for the console line or any number of vty lines.
To change the default privilege level:
- host1(config)#line console 0
- host1(config-line)#
or on one or more vty lines
- host1(config)#line vty 0 12
- host1(config-line)#
![]() |
Note: The latter command configures vty lines 0 to 12. |
- host1(config-line)#privilege level 5
The default privilege level for the specified line (or lines) changes. The new values take effect immediately for any new users. If using the console line, you must exit out of the CLI and reestablish a connection before the default takes effect.
If you are validating through RADIUS or TACACS+ and the server specifies an enable level, that enable level takes precedence over the line privilege level.
privilege level
- host1(config-line)#privilege level 5
![]() |
Note: You must access the CLI at privilege level 15 to view or use this command. |
You can view CLI privilege information for yourself (the current user), all connected users on the router, or for any modified CLI commands.
Use the show privilege command to view your current privilege level.
show privilege
- host1#show privilege
- Privilege level is 10
Use the show users detail command to view the privilege levels for all users currently connected to the router. See Monitoring the FTP Server for information about the show users detail command.
Use the show configuration command to view the changed privilege levels for any modified CLI commands. See Saving the Current Configuration for information about the show configuration command.
![]() |
Note: The show configuration command output displays output specific to the session access level. For example, if the session is enabled at level 5, issuing the show configuration command displays only output for commands at level 5 and below. |
show privilege group
host1(config-if)#show privilege group superUser The following groups are directly reachable: 14 dailyAdmin
The following groups are reachable: 1 14 2 3 4 basicUser dailyAdmin dailyTroll minUser