How to execute the binary systemctl to start or stop services

Prev Next

This document provides information on how to execute the systemctl binary to start or stop services with sudo rules.

Since the systemctl binary requires root permissions to perform some actions, it is necessary to use the Sudo Rules feature to address this requirement.

  1. In the Segura® Platform, in the navigation bar, hover over the Products menu and select EPM.
  2. In the side menu, select Policies > Linux > Sudo Rules.
  3. In the Rules for sudo report, click Add and select General or Device.
  4. In the Registration rules for sudo screen, enter the following information:
    1. In the Identification name * field, enter a name to identify the rule.
    2. In the Enabled * field, select Yes to enable the rule.
    3. In the Commands for rule application (must be used the full path) * field, enter the following command: /usr/bin/systemctl action service_binary_name. For example: /usr/bin/systemctl restart nginx.
    4. In the It should be NOPASSWD? * field, select to ask or not the user to enter their password.
    5. In the Should it be FOLLOW? * field, select to be able to edit symbolic links.
    6. In the Should it be SETENV? * field, select to be able to set system parameters.
    7. Optional: In the Description field, enter a brief description of the rule.
    8. Optional: If you want to apply the sudo rules for devices, configure the Devices tab properly.
  5. Click Save.