Please note: This website includes an accessibility system. Press Control-F11 to adjust the website to people with visual disabilities who are using a screen reader; Press Control-F10 to open an accessibility menu.
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’s hostname from the command line.
Before You Begin
Review the warnings and notes below, to ensure a smooth transition from one hostname to another.
NOTE: Your hostname will be viewable in every email header, so choose wisely.
NOTE: Your hostname must be in the format of a subdomain (server.example.com).
NOTE: Avoid choosing a subdomain that you are currently (or plan on) hosting in a cPanel account.
NOTE: Changing your hostname will require an update of the SSL Certificate for services (such as cPanel/Webmail, FTP, Dovecot (SMTP/IMAP), etc.).
NOTE: 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.
IMPORTANT: 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 Live Support to request an update to your hostname.
IMPORTANT: Our Systems Administrator will need to update the IP address Pointer (PTR) record on your behalf. Once you have changed the hostname in WHM, you can submit a ticket to request an update to your PTR.
The prompt should appear, without any output being displayed. You can run the following command to confirm the hostname has been changed:
hostname
The output should display similarly to the example below:
root@example.com ~ $ hostnameserver.example.com
Congratulations! Now you know how you can change the hostname of your server from the command line.
IC
InMotion Hosting ContributorContent Writer II
InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!
Get web hosting that grows with your business. Our all-in-one hosting platform gives you everything your website needs to scale - so you can focus on the next big thing for you and your business.