Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a linux (CentOS 5.2) server with the name, which is correctly returned when I run 'hostname'. When I run 'hostname -s' however it returns "localhost" which is causing some backup scripts to put stuff in a "localhost" directory instead of a "myserver" directory.

All of our other CentOS boxes correctly return the first part of their hostname when 'hostname -s', where do I go on this server to make it behave the same? Other than having "" in /etc/sysconfig/network what should I be looking at?

share|improve this question
up vote 2 down vote accepted

Checkout your /etc/hosts file. It should go something like:   myserver  localhost.localdomain   localhost
::1     localhost6.localdomain6 localhost6

If you do not have myserver by itself, or localhost comes before it, things maybe getting confused.

share|improve this answer
That was it, thanks. – DrStalker Mar 15 '10 at 6:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.