Agent Command Line Guide

This guide provides instructions on managing the Automox agent via command-line interface across different operating systems. It covers topics such as installation paths, setting access keys, assigning device groups, deregistering devices, checking compatibility, redirecting output, configuring script execution directories, and reinstalling the agent. This guide is essential for users seeking to efficiently control and customize the Automox agent's behavior through command-line operations.

Operating System Install Locations

Based on the operating system, the Automox agent installs to these locations:

macOS

Copy
/usr/local/bin/amagent

Windows

Copy
C:\Program Files (x86)\Automox\amagent.exe

Linux

Copy
/opt/amagent/amagent

Command Line Help

Copy
--help

Basic help information for command line options can be found by executing the following:

Copy
amagent --help
amagent -h

Setting the Zone Access Key

Copy
--setKey

The access key binds the agent and device to a specific zone in the Automox console. This command can be used to move a device from one zone to another, or to change the zone if an incorrect access key was provided during installation.

Follow these steps:

  1. Deregister the device and set the new access key. See Managing Keys for information about access keys.
    Copy
    <path to amagent>/amagent --setkey <NEW_ZONE_ACCESS_KEY>
  2. Restart the Automox agent.

Linux:

Copy
sudo service amagent restart

macOS:

Copy
sudo launchctl kickstart -k system/com.automox.agent

Windows:

Copy
net stop amagent
net start amagent

Assigning a Group to a Device

Copy
--setgrp

This command defines the Automox group that this agent should be placed in when it first connects with the Automox platform. This allows you to easily add the device to a group and is a no-touch way to specify the policies you want to add to the device. When using the --setgrp flag, you must predefine the Default Group/ to the group name that you are providing to the setgrp command. When specifying groups, remember to separate them with a forward-slash / character.

Follow these steps:

  1. To set the device group to the Engineering group, issue the following command:
    Copy
    amagent --setgrp 'Default Group/Engineering' (macOS and Linux)
  2. Copy
    amagent --setgrp "Default Group/Engineering" (Windows)
    Deregister the agent:
    Copy
    amagent --deregister
  3. Restart the Automox Agent:

Linux:

Copy
sudo service amagent restart

macOS:

Copy
sudo launchctl kickstart -k system/com.automox.agent

Windows:

Copy
net stop amagent
net start amagent

Deregistering a Device

Copy
--deregister

When the Automox agent runs for the first time, it establishes an identity with the Automox servers using public-key cryptographic methods. If you ever need to reset the agent and have it re-register as a new device, you can deregister the agent.

Checking for Device Compatibility with Automox

After a device is connected, Automox runs a compatibility check to ensure that we can successfully manage the device. Each operating system has its own compatibility checklist. For more details about what is passing or failing on the compatibility check, click the Review Checklist link to view the Compatibility Checklist in the Device Details page in the Automox console. To perform this check directly from the device via the agent command line, issue this command:

For Agent Versions 1.43.142 and Earlier

Copy
amagent --checkcompat

For Agent Versions 1.44.5 and Later

Copy
amagent selftest

Redirect Agent Output to stdout of a Console

This command runs the agent in the current console. Logging is piped to stdout.


Note: Before running with this command, it is recommended that you disable the agent service.

Copy
amagent -c

Setting the Directory for Executing Scripts

The Automox agent uses scripts to execute most of its functions including scanning and patching. These scripts execute from a fixed directory on the local device. By default this is set to the following locations:

Windows: C:\Program Files (x86)\Automox\

macOS: /Library/Application Support/Automox/

Linux: /var/lib/amagent

If you prefer these actions to run from a different default path, use an agent command to set that on the device (--setexecdir). The next time the Automox agent service is restarted, it will use the newly specified location for running its scripts. Some endpoint security applications block scripts that don't originate from a designated location. Therefore, the most common reason to modify this setting is to move it to a trusted or preferred directory for your security software.

Note: For macOS, do not set the execdir to any directory or subdirectory of a user’s Desktop, Downloads, or Documents folder. Temporary directories created for executing commands are not cleaned up if they are in an OS protected special location. See also Control access to your files and folders on Mac.

Output from amagent --help:

Copy
automox@ubuntu:/opt/amagent$ ./amagent --help
amagent 1.0-28 (go1.12.4) Copyright (c) 2019 Automox, Inc.usage:
[--setkey &lt;accesskey&gt;] Sets the access key
[--setgrp &lt;groupname&gt;] Sets the initial group name
[--setexecdir &lt;directory&gt;] Sets the temporary directory to execute scripts from
[--deregister] Deregisters this server from Automox
[--checkcompat] Checks the compatibiltiy and connectivity with Automox server # Only versions 1.43.142 and earlier
[selftest] Checks the compatibiltiy and connectivity with Automox server # Only versions 1.44.5 and later
[-c] Runs the agent in the current console. Logging is piped to stdout. # (It is recommend to disable the agent service before running with this command)
[-h | --help] Displays this message
Note: To restore the default, you can set the original directory path in the same manner as a new one.

Reinstalling the Automox Agent

To reinstall the Automox agent, ensure that the agent has first been deregistered and then removed.

  1. Deregister the agent as described previously in Deregistering a Device.
  2. Remove the agent. See Removing the Automox Agent.
  3. Follow the instructions in Automox Agent Installation Overview for your device.