{"id":13237,"date":"2019-04-01T09:03:11","date_gmt":"2019-04-01T09:03:11","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=13237"},"modified":"2019-04-01T09:03:11","modified_gmt":"2019-04-01T09:03:11","slug":"how-to-control-systemd-services-on-remote-linux-server","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/01\/how-to-control-systemd-services-on-remote-linux-server\/","title":{"rendered":"How to Control Systemd Services on Remote Linux Server"},"content":{"rendered":"<p>Systemd system and services manager can be controlled using the\u00a0<a href=\"https:\/\/www.tecmint.com\/manage-services-using-systemd-and-systemctl-in-linux\/\" target=\"_blank\" rel=\"noopener\">systemctl command<\/a>\u00a0line utility. It enables you to manage\u00a0<strong>systemd<\/strong>\u00a0locally or on a remote Linux machine over the SSH protocol.<\/p>\n<p>In this short article, we will show you how to manage systemd system and service manager on a remote Linux machine over a SSH session.<\/p>\n<p><strong>Attention<\/strong>: We recommend using public\/private key pairs for passwordless authentication for SSH, as opposed to passwords, and also employing additional methods to secure SSH service, as explained in these guides.<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps\/\" target=\"_blank\" rel=\"noopener\">SSH Passwordless Login Using SSH Keygen in 5 Easy Steps<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/5-best-practices-to-secure-and-protect-ssh-server\/\" target=\"_blank\" rel=\"noopener\">5 Best Practices to Secure and Protect SSH Server<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/block-ssh-and-ftp-access-to-specific-ip-and-network-range\/\" target=\"_blank\" rel=\"noopener\">How to Block SSH and FTP Access to Specific IP and Network Range<\/a><\/li>\n<\/ol>\n<p>To connect to a remote server, run\u00a0<strong>systemctl<\/strong>\u00a0with the\u00a0<code>--host<\/code>\u00a0or\u00a0<code>-H<\/code>\u00a0flag as follows. In the command below, we are connecting to the remote server as the\u00a0<strong>root<\/strong>\u00a0user and\u00a0<strong>status<\/strong>\u00a0is a subcommand of systemctl utility used to view the status of the\u00a0<strong>httpd<\/strong>\u00a0service on\u00a0<strong>centos.temint.lan<\/strong>\u00a0(remote Linux server).<\/p>\n<pre>$ systemctl --host root@centos.temint.lan status httpd.service\r\nOR\r\n$ systemctl -H root@centos.temint.lan status httpd.service\r\n<\/pre>\n<div id=\"attachment_28340\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/01\/manage-systemd-on-a-remote-server.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-28340\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/01\/manage-systemd-on-a-remote-server.png\" sizes=\"auto, (max-width: 951px) 100vw, 951px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/01\/manage-systemd-on-a-remote-server.png 951w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/01\/manage-systemd-on-a-remote-server-768x191.png 768w\" alt=\"Manage Systemd Service on Remote Linux\" width=\"951\" height=\"237\" aria-describedby=\"caption-attachment-28340\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-28340\" class=\"wp-caption-text\">Manage Systemd Service on Remote Linux<\/p>\n<\/div>\n<p>Similarly, you can also start, stop or restart remote systemd service as shown.<\/p>\n<pre>$ systemctl --host root@centos.temint.lan start httpd.service   \r\n$ systemctl --host root@centos.temint.lan stop httpd.service\r\n$ systemctl --host root@centos.temint.lan restart httpd.service\r\n<\/pre>\n<p>To end the session, simply type\u00a0<code>[Ctrl+C]<\/code>. For more information and usage options, see the\u00a0<strong>systemctl<\/strong>\u00a0man page:<\/p>\n<pre>$ man systemctl \r\n<\/pre>\n<p>That\u2019s all for now! What follows is an assortment of systemd articles which you\u2019ll find useful:<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/systemd-replaces-init-in-linux\/\" target=\"_blank\" rel=\"noopener\">The Story Behind: Why \u2018init\u2019 Needed to be Replaced with \u2018systemd\u2019 in Linux<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/linux-boot-process-and-manage-services\/\" target=\"_blank\" rel=\"noopener\">Managing System Startup Process and Services (SysVinit, Systemd and Upstart)<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/manage-systemd-logs-using-journalctl\/\" target=\"_blank\" rel=\"noopener\">Manage Log Messages Under Systemd Using Journalctl [Comprehensive Guide]<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/create-new-service-units-in-systemd\/\" target=\"_blank\" rel=\"noopener\">How to Create and Run New Service Units in Systemd Using Shell Script<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/change-runlevels-targets-in-systemd\/\" target=\"_blank\" rel=\"noopener\">How to Change Runlevels (targets) in SystemD<\/a><\/li>\n<\/ol>\n<p>In this article, we showed you how to manage systemd system and service manager on a remote Linux machine. Use the feedback section to ask questions or share your thoughts about this guide.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/control-systemd-services-on-remote-linux-server\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Systemd system and services manager can be controlled using the\u00a0systemctl command\u00a0line utility. It enables you to manage\u00a0systemd\u00a0locally or on a remote Linux machine over the SSH protocol. In this short article, we will show you how to manage systemd system and service manager on a remote Linux machine over a SSH session. Attention: We recommend &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/01\/how-to-control-systemd-services-on-remote-linux-server\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Control Systemd Services on Remote Linux Server&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13237","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13237","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=13237"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13237\/revisions"}],"predecessor-version":[{"id":13238,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13237\/revisions\/13238"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=13237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=13237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=13237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}