Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Define Operational Mode Commands to Allow in an Op Script

Operation (op) scripts automate operational tasks and network troubleshooting on Junos devices. Op scripts can execute operational mode commands within the script. By default, the user executing the script cannot execute operational mode commands within a script for which their login class does not have permission to execute. However, you can configure an op script to execute specific operational mode commands regardless of the user permissions. Users in the Junos OS super-user login class can configure the allow-commands statement at the [edit system scripts op file filename] hierarchy level to define the commands. The script executes the specified operational mode commands, even if the user who executes the script does not have permissions to execute those commands.

Note:

The allow-commands statement does not support executing configuration mode commands.

Note:

The allow-commands statement is only supported for op scripts that are local to the device. Remote op scripts that you execute using the op url command do not support executing unauthorized operational mode commands even when you configure the allow-commands statement.

In the following example, the sam.slax op script contains the following code:

The op script uses the set date operational mode command. User user1 does not have permission to execute this command.

The following configuration enables the sam.slax op script to execute the set date operational mode command:

User user1 can now successfully execute the op script.

To define the operational mode commands to allow in an op script:

  1. Navigate to the op script for which you want to allow operational mode commands.

    Note:

    Only users who belong to the Junos OS super-user login class can configure op scripts.

  2. Define the operational mode commands to allow.

  3. Commit the configuration.