Running systemctl on a Remote System

You can run systemctl commands on a remote system where the sshd service is running. Include the -H option and the hostname with the systemctl command to control the system remotely.

For more information see the systemctl(1) manual page.

The following example shows how to check the status of the crond service on a remote system.

  1. Run the following command: systemctl -H 10.0.0.2 status crond
    The remote system returns results similar to the following:
    ● crond.service - Command Scheduler
         Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; preset: enabled)
         Active: active (running) since Thu 2025-01-09 09:38:06 GMT; 7min ago
       Main PID: 2399
          Tasks: 1 (limit: 99824)
         Memory: 1.0M (available: 14.8G)
            CPU: 9ms
         CGroup: /system.slice/crond.service
                 └─2399 /usr/sbin/crond -n
    Note that to run systemd commands that require root access, the system must allow authentication for the root account over SSH. For example, you might run systemctl -H root@10.0.0.2 restart httpd.