Running Systemd commands on remote host from your local host

mayeu profile image Mayeu Originally published at mayeu.me on ・1 min read

While I was reading the pretty awesome Archlinux wiki for something completely different, I found out that one can launch any systemctlcommand to a remote host via the --host (or -H) flag.

So let say you want to check the cron process on a server named kitten:

$ systemctl -H root@kitten status cron
● cron.service - Regular background program processing daemon
   Loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2018-07-28 11:36:37 CST; 2 months 25 days ago
     Docs: man:cron(8)
 Main PID: 1045
    Tasks: 1 (limit: 4643)
   CGroup: /system.slice/cron.service
           └─1045 /usr/sbin/cron -f

Nice right? Under the hood this use SSH so you must have access to the host. And you can, of course, use any systemctl command, not just status ;)

Have fun 👋

This post was originally published on mayeu.me.

Posted on by:

mayeu profile



🌏 Remote #DevOps & #Automation ⚙️ nerd to hire | 💞 Make love, not #startup 💕 | 🗝️ #CryptoPonyCypherpunkUtopia 🎠 often | In tea I trust 🍵


Editor guide

Nice trick ...though feels like making Linux a bit more Windows-y. :p


What are you referring to in Windows that is similar?


Most of the Windows system administrator tools allow you to run them either locally or against a remote system.