1 | Restricting Access to the CLI |
1.1 | Configure a CLI Command Alias or Privilege |
1.2 | Command Alias |
1.3 | Configure a CLI Command Privilege |
1.4 | Create a CLI Command Macro |
2 | How to Create a Command Macro |
Copyright |
© Ericsson AB 2009–2010. All rights reserved. No part of this document may be reproduced in any form without the written permission of the copyright owner. | ||||||
Disclaimer |
The contents of this document are subject to revision without notice due to continued progress in methodology, design and manufacturing. Ericsson shall have no liability for any error or damage of any kind resulting from the use of this document. | ||||||
Trademark List |
|

1 Restricting Access to the CLI
This document contains information on how to set manage access to the CLI of the SmartEdge router through command privilege levels, how to configure CLI command aliases, and CLI command macros.
1.1 Configure a CLI Command Alias or Privilege
A command alias is a character string that you would like to use in place of a command string. Use aliases to create shortcuts for frequently used commands. Each command has a privilege level that determines, given the privilege assigned to the administrator, who can enter the command.
To modify the privilege for a CLI command or create an alias for it, perform the tasks described in Table 1; enter all commands in global configuration mode.
Task |
Root Command |
---|---|
Define an alias for a command. |
|
Assign a privilege level to a command to expand or restrict its use. |
- Note:
- To disable alias processing for a particular command, begin the command line with the backslash (\) character.
Caution! | ||
Risk of disabled commands. It is possible to create an alias that
disables existing commands. To reduce the risk, use care when you
define aliases. Avoid defining an alias name that is a command keyword
or a partial keyword for the CLI. Aliases apply to all users on a
system.
|
1.2 Command Alias
The following example defines the string, pc, as a shortcut for the show port counters command, and then demonstrates the use of the new alias:
[local]Redback(config)#alias inherit pc show port counters [local]Redback(config)#end [local]Redback#pc 4/1
Port Type Pkts/Bytes Sent Pkts/Bytes Received 4/1 atm 0 0
For more information on the show port counters command, see the Command List.
1.3 Configure a CLI Command Privilege
The following example assigns the minimum privilege level to all commands that start with the snmp keyword to 12:
[local]Redback(config)#privilege config inherit level 12 snmp
1.4 Create a CLI Command Macro
A command macro is an extended alias that allows you to define a sequence of commands to run with the macro name, instead of entering each command separately.
To create a macro for one or more CLI commands, perform the tasks described in Table 2.
Task |
Root Command |
Notes |
---|---|---|
1. Define a macro and enter macro configuration mode. |
Enter this command in global configuration mode. | |
2. Specify a command in the macro. |
Enter this command in macro configuration mode. Use this command for each command to be included in the macro. | |
3. Complete the macro. |
Enter this command in all modes. |
2 How to Create a Command Macro
The following example defines the show-port-all macro:
[local]Redback(config)#macro inherit show-port-all [local]Redback(config-macro)#seq 10 show port $1/$2 [local]Redback(config-macro)#seq 20 show circuit $1/$2 [local]Redback(config-macro)#exit
The following example displays port data for port 3 of the traffic card in slot 4 using the same macro:
[local]Redback>show-port-all 4 3