{"id":4431,"date":"2018-03-07T17:57:48","date_gmt":"2018-03-07T17:57:48","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2018\/03\/07\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/"},"modified":"2021-11-19T01:39:12","modified_gmt":"2021-11-19T06:39:12","slug":"how-to-change-a-server-s-hostname-using-the-command-line-interface","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/","title":{"rendered":"How to Change A Server&#8217;s Hostname Using the Command Line Interface"},"content":{"rendered":"<p>Changing the <strong>hostname<\/strong> of your server may be necessary for several reasons. For example, if you are utilizing your server as a Mail Server for your domain(s) hosted, then changing the hostname can <a href=\"\/support\/email\/configuring-your-vps-dedicated-server-as-a-mail-server\/\" target=\"_blank\" title=\"Click here to navigate to our guide and learn more about how to comply with common mail server guidelines and policies.\" rel=\"noopener\">prevent your emails from going to Spam\/Junk<\/a>. In this article, you can learn <strong>how to change your server&#8217;s hostname from the command line<\/strong>.<\/p>\n<h3>Before You Begin<\/h3>\n<p>Review the warnings and notes below, to ensure a smooth transition from one hostname to another.<\/p>\n<div class=\"alert alert-info\" role=\"alert\"><b>NOTE: <\/b>Your hostname will be viewable in every email header, so choose wisely.<\/div>\n<div class=\"alert alert-info\" role=\"alert\"><b>NOTE: <\/b>Your hostname must be in the format of a subdomain (server.example.com).<\/div>\n<div class=\"alert alert-info\" role=\"alert\"><b>NOTE: <\/b>Avoid choosing a subdomain that you are currently (or plan on) hosting in a cPanel account.<\/div>\n<div class=\"alert alert-info\" role=\"alert\"><b>NOTE: <\/b>Changing your hostname will require an update of the SSL Certificate for services (such as cPanel\/Webmail, FTP, Dovecot (SMTP\/IMAP), etc.).<\/div>\n<div class=\"alert alert-info\" role=\"alert\"><b>NOTE: <\/b>Changing your hostname will require an update to all references of the previous hostname in your connection(s) to the server (such as IMAP\/SMTP\/POP, FTP, and remote MySQL clients) with the new hostname.<\/div>\n<div class=\"alert alert-danger\" role=\"alert\"><b>IMPORTANT: <\/b>The new hostname will remain as assigned until your server is restarted. In order for this change to persist through restarts, our Systems Administrator will need to update your hostname. Once you have changed the hostname in WHM, you can contact our <a class=\"alert-link\" href=\"\/support\/amp\/how-to-get-great-technical-support\/\" target=\"_blank\" title=\"Click here to navigate to our guide and learn how to contact our Live Support 24\/7\/365.\" rel=\"noopener\">Live Support<\/a> to request an update to your hostname.<\/div>\n<div class=\"alert alert-danger\" role=\"alert\"><b>IMPORTANT: <\/b>Our Systems Administrator will need to update the <b>IP address Pointer (PTR) record<\/b> on your behalf. Once you have changed the hostname in WHM, you can <a class=\"alert-link\" href=\"\/support\/amp\/how-to-get-great-technical-support\/#submit-ticket\" target=\"_blank\" title=\"Click here to navigate to our guide and learn how to submit a ticket.\" rel=\"noopener\">submit a ticket<\/a> to request an update to your PTR.<\/div>\n<h2>Change Hostname<\/h2>\n<div class=\"alert alert-danger\" role=\"alert\"><b>IMPORTANT: <\/b><a href=\"\/support\/amp\/obtain-root-access\/\" target=\"_blank\" title=\"Click here to navigate to our guide and learn how to obtain root access.\" rel=\"noopener\">Root access<\/a> on a <a href=\"https:\/\/www.inmotionhosting.com\/vps-hosting\" target=\"_blank\" title=\"Click here to navigate to our main website and review our available VPS hosting plans.\" rel=\"noopener\">VPS<\/a>\/<a href=\"https:\/\/www.inmotionhosting.com\/dedicated-servers\" target=\"_blank\" title=\"Click here to navigate to our main website and review our available Dedicated Server hosting plans.\" rel=\"noopener\">Dedicated Server<\/a> hosting is required to follow the steps below.<\/div>\n<ol class=\"article_list\">\n<li> <a href=\"\/support\/server\/ssh\/how-to-login-ssh\/\" target=\"_blank\" title=\"Click here to navigate to our guide and learn how to connect to your server using SSH.\" rel=\"noopener\">SSH<\/a> into your server using the <b>root<\/b> user.<\/p>\n<\/li>\n<li> Run the following command:<\/p>\n<pre class=\"cli\"><span style=\"color:turquoise;\">hostname server.example.com<\/span><\/pre>\n<\/li>\n<p>The prompt should appear, without any output being displayed. You can run the following command to confirm the hostname has been changed:<\/p>\n<pre class=\"cli\"><span style=\"color:turquoise;\">hostname<\/span><\/pre>\n<p>The output should display similarly to the example below:<\/p>\n<pre class=\"cli\"><span style=\"color:slategrey;\">root@example.com ~ $ <\/span><span style=\"color:turquoise;\">hostname<\/span> <span style=\"color:white;\">server.example.com<\/span><\/pre>\n<\/ol>\n<p><b>Congratulations!<\/b> Now you know how you can <strong>change the hostname of your server from the command line<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Changing the hostname of your server may be necessary for several reasons. For example, if you are utilizing your server as a Mail Server for your domain(s) hosted, then changing the hostname can prevent your emails from going to Spam\/Junk. In this article, you can learn how to change your server&#8217;s hostname from the command<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/\"> Read More ><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4308],"tags":[],"class_list":["post-4431","post","type-post","status-publish","format-standard","hentry","category-linux"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Change A Server&#039;s Hostname Using the Command Line Interface | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"In this article, you can learn how to change your server&#039;s hostname from the command line.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Change A Server&#039;s Hostname Using the Command Line Interface | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"In this article, you can learn how to change your server&#039;s hostname from the command line.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-07T17:57:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-11-19T06:39:12+00:00\" \/>\n<meta name=\"author\" content=\"InMotion Hosting Contributor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InMotion Hosting Contributor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/\"},\"author\":{\"name\":\"InMotion Hosting Contributor\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5fbfcaed32a2672fb83ab312f5b7237b\"},\"headline\":\"How to Change A Server&#8217;s Hostname Using the Command Line Interface\",\"datePublished\":\"2018-03-07T17:57:48+00:00\",\"dateModified\":\"2021-11-19T06:39:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/\"},\"wordCount\":360,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/\",\"name\":\"How to Change A Server's Hostname Using the Command Line Interface | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2018-03-07T17:57:48+00:00\",\"dateModified\":\"2021-11-19T06:39:12+00:00\",\"description\":\"In this article, you can learn how to change your server's hostname from the command line.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Change A Server&#8217;s Hostname Using the Command Line Interface\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5fbfcaed32a2672fb83ab312f5b7237b\",\"name\":\"InMotion Hosting Contributor\",\"description\":\"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!\",\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/inmotion-hosting\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/john-paul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Change A Server's Hostname Using the Command Line Interface | InMotion Hosting","description":"In this article, you can learn how to change your server's hostname from the command line.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/","og_locale":"en_US","og_type":"article","og_title":"How to Change A Server's Hostname Using the Command Line Interface | InMotion Hosting","og_description":"In this article, you can learn how to change your server's hostname from the command line.","og_url":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2018-03-07T17:57:48+00:00","article_modified_time":"2021-11-19T06:39:12+00:00","author":"InMotion Hosting Contributor","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"InMotion Hosting Contributor","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/"},"author":{"name":"InMotion Hosting Contributor","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5fbfcaed32a2672fb83ab312f5b7237b"},"headline":"How to Change A Server&#8217;s Hostname Using the Command Line Interface","datePublished":"2018-03-07T17:57:48+00:00","dateModified":"2021-11-19T06:39:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/"},"wordCount":360,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/","url":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/","name":"How to Change A Server's Hostname Using the Command Line Interface | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2018-03-07T17:57:48+00:00","dateModified":"2021-11-19T06:39:12+00:00","description":"In this article, you can learn how to change your server's hostname from the command line.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/how-to-change-a-server-s-hostname-using-the-command-line-interface\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Change A Server&#8217;s Hostname Using the Command Line Interface"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5fbfcaed32a2672fb83ab312f5b7237b","name":"InMotion Hosting Contributor","description":"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!","sameAs":["https:\/\/www.linkedin.com\/company\/inmotion-hosting\/","https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/john-paul\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=4431"}],"version-history":[{"count":2,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4431\/revisions"}],"predecessor-version":[{"id":91956,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4431\/revisions\/91956"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=4431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=4431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=4431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}