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: sudo systemctl -H root@10.0.0.2 status crond
    The remote system returns results similar to the following:
    root@10.0.0.2's password: password
    crond.service - Command Scheduler
         Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; preset: enabled)
         Active: active (running) since Tue 2024-08-20 09:44:42 CDT; 1 day 6h ago
       Main PID: 2421 (crond)
          Tasks: 1 (limit: 196846)
         Memory: 1.3M
            CPU: 1.174s
         CGroup: /system.slice/crond.service
                 └─2421 /usr/sbin/crond -n