Technology TidBits

Answers to various technical questions on php programming, mysql, linux, and many more categories.
25% off Hosting at HostGator.com:
Use Code techbits25



My hostname keeps reverting to localhost (or localhost.localdomain) - how can I permanently fix this?

Last updated: 06/29/2009

This problem is becoming more of an issue because so many mail server anti-SPAM techniques check for proper "HELO" settings from your smtp (mail) server. 

So if your mail server thinks it is "localhost.localdomain", you will find that some of your email gets blocked arbitrarily.  Such is the status of the 'Net these days.

So, how to fix this permanently?  Here are 2 steps that are guaranteed to fix your hostname problem

  1. Read all the articles about changing your /etc/hosts, /etc/hostname, /etc/resolv.conf, /etc/sysconfig/networks and other files.  Try rebooting, and see if anything works.  Try editing your Plesk configuration.  You might get lucky, and get things fixed that way.  Spend a few hours if you need to - take your time. 
  2. Now, edit this file: /etc/rc.d/rc.local

Add this line at the bottom:

hostname [your hostname.domainname] (example: hostname mail.abc.com)

Add these lines to restart your mail server (will vary based on your mail server)

qmail stop
qmail start

Try out reboot, and see how it looks. 

NOTE:  This is not the official way to do this.  If you want to follow the official way to do it, see Step 1, and repeat as often as necessary. 

 

blog comments powered by Disqus
Have your own Tech-bit to contribute? Submit it here

Other questions in this category:
How can I find out what is taking up all the space on my Linux server?
How can I use 'find' to execute commands on all files found?
How do I figure out how many processors and the speeds, etc. are in my Linux box?
How can I remove DOS linebreaks (^M) from my files?
How can I mirror / backup a set of files via ncftp?
How can I determine if iptables is blocking traffic to my site?
Why does my ftp file listing stop at 2000 files?
How can I relocate files from a tar archive with extracting the files?
How can I get a list of files most recently updated / edited?
Some find examples for excluding a directory, and executing commands
Useful script to track spammers connecting to your server
How can I turn off / view my linux firewall using iptables?
How can I split a bit tar file into multiple small files?
How can I exclude some files / directories from a tar file?



Powered by KnowledgebasePublisher 1.1
Host Gator
Content provided by Roberts WebForge, Inc.