Often system administrators need to manage systemd services and processes on their local as well as remote systems on their network. They use systemctl utility for this purposes. It allows you to manage system not only on local systems but also remote systems. But while using systemctl they need to manage systemd services over SSH. In this article, we will learn how to manage systemd services on remote Linux systems.
How to Manage Systemd Services on Remote Linux Systems
Here are the steps to manage systemd system and service manager on remote Linux machine using SSH. It is advisable to use public/private key pairs instead of using passwords to secure SSH connections.
To manage remote services using systemctl use –host or -H option followed by remote username & address, followed by the systemctl command. Here is an example to start httpd (Apache web server) service.
$ systemctl --host email@example.com status httpd.service OR $ systemctl -H firstname.lastname@example.org status httpd.service
In the above commands, 184.108.40.206 is the IP or address of remote server where you want to manage the httpd service. test_user is the username.
You may be asked for remote password, depending on how you have configured the remote SSH connection.
In this article, we have learnt how to manage systemd services on remote Linux systems.