Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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'm trying to configure a Ubuntu 10.4 server and have a little confusion with configuring with hostnames.

My domain is and the hostname would be one. If I'm correct, when I've configured this properly, typing hostname at the prompt would yield one and hostname --fqdn would yeild Am I right?

Could you tell me what values I would need to put in /etc/hostname and /etc/hosts?

Although a very trivial thing, I haven't been able to configure it to get the desirable output. I'm definitely missing something here.

Thanks everyone.

share|improve this question
up vote 4 down vote accepted

In /etc/hostname you have to put the unqualified name for the host; in your example you need to put


In /etc/hosts, which is a DNS resolving file, you need to specify which IP address is host one. Let's suppose one has IP address, then you have to add this line to your /etc/hosts: one

(as stated on man hosts: *IP_address canonical_hostname [aliases...]*).

Hope this helps

EDIT: I forgot: for Ubuntu AFAIK you have to run /etc/init.d/ as root after modifying the hostname file. I'm not sure, but that's how it's done in Debian.

share|improve this answer
The init.d script likely just reads /etc/hostname and runs the hostname command. – grawity Aug 22 '11 at 19:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .