MID Server privileged commands
-
- UpdatedFeb 1, 2024
- 5 minutes to read
- Washington DC
- MID Server
To discover certain information on a host server, the MID Server must run SSH commands with higher privileges. The platform provides default privileged commands for the MID Server to use and the ability to add additional commands to the system.
![]() |
An example of information that requires elevated privileges is information about storage disks on a host server, retrieved with the fdisk -l command. If your system cannot use sudo commands, you must configure the hosts in your network to use one of the other privileged commands. You can configure different privileged commands for different hosts. However, Discovery supports only one privileged command per host.
For a list of possible SSH commands requiring root privileges, see SSH credentials.
Long-running commands with sudo
Configure J2SSH and ServiceNow SSH to prevent long running commands using sudo from failing when the MID Server disconnects.
ServiceNow SSH allows probes to run sudo against individual commands or an entire, long-running script. This is also supported for the pbrun and pfexec privileged commands.
Sudo for individual commands
- The
!requiretty
option is required. - Allow individual commands to be run by the user in the provided credential with
NOPASSWD
configured. - The target specifies an individual sudo call in the command or referenced scripts. For
example, set sudo as
"sudo fdisk -I"
or"${sudo:fdisk -I}"
rather than"must_sudo"
for the entire script.
Running sudo on an entire script
If any of the required sudoer configuration requirements for individual commands is not in place, Discovery applies sudo to the initial and complete probes, and does not execute sudo remotely inside the command. This condition can be forced by setting must_sudo on the probe and eliminating any sudo commands within the probe.
This approach prevents long running commands from failing when the probe disconnects, but cannot specify individual commands in the sudoers configuration.
Logging
The logs from ServiceNow SSH sudo activity run against an entire script show cryptic entries, such as /tmp/.run.aef13123fe124123, which prevent administrators from controlling permissible commands and knowing the exact command that was run. Sudo run against individual commands produces more detailed log entries, such as /sbin/fdisk –l.
Add a new privileged command for use by the MID Server
Add a new privileged command to the Privileged Command [privileged_command] table that is available to your MID Servers.
Before you begin
Role required: admin
About this task
Procedure
Configure the MID Server to use specific privileged commands
You can configure the MID Server to use specific commands in a defined order.
Before you begin
Role required: admin
Procedure
Create a pbrun profile privileged command
You can create a special configuration for the pbrun privileged command that allows it to run as a profile.
Before you begin
Role required: discovery_admin, admin
About this task
Procedure
What to do next
Return to Configuring MID Servers.