Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a linux (CentOS 5.2) server with the name myserver.mycompnay.com, 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 "HOSTNAME=myserver.mycompnay.com" in /etc/sysconfig/network what should I be looking at?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Checkout your /etc/hosts file. It should go something like:

127.0.0.1   myserver.mycompany.com   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

 
discard

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.