# Login Prompt question

## fargazer

I have looked through the various documents, and must have missed the answer to this one.  After a new install, my login prompt now is:

 *Quote:*   

> This is lucy.(none) (Linux i686 2.6.4-gentoo-r1) 00:16:52

 

Where does the system get the domain, which in the above is (none)?  I would like to set that to the domain I am using, but it's evidently not pulling the value I have in /etc/dnsdomainname.

----------

## zerb

/etc/dnsdomainname

/etc/hostsname

and 

/etc/hosts looking like

***.***.***.***       lucy.*.*      lucy

----------

## Rainmaker

the (.none) you're seeing, is actually the NIS domain name. Set by using:

echo nis.homenetwork > /etc/nisdomainname

----------

## pjp

Moved from Installing Gentoo.

----------

## fargazer

No luck so far.

/etc/dnsdomainname has a single line, "locallan" in it.

/etc/hostsname has two lines; the IPs and names are separated by tabs:

192.168.1.3  lucy.locallan  lucy

127.0.0.1  lucy.locallan  lucy

/etc/hosts has three lines besides the standard comments and IPV6 stuff (again, separated by tabs):

127.0.0.1  localhost  lucy.locallan  lucy

192.168.1.1  gateway  gateway.locallan

192.168.1.10  rangersmith.locallan  rangersmith

/etc/nisdomainname has a single entry in it:

nis.locallan

===

When I changed /etc/hostname (as opposed to hostsname) from lucy to lucy.locallan the prompt became "lucy.locallan.(none).

My guess is I have done something silly, probably to do with the nisdomainname.  Any ideas?

----------

## justanothergentoofanatic

You need to do the following:

1) rc-update add domainname default

2) echo "lucy" > /etc/hostname (NOT /etc/hostsname)

3) echo "locallan" > /etc/dnsdomainname

4) rm /etc/nisdomainname

5) rm /etc/hostsname

6) set up /etc/hosts EXACTLY like this:

127.0.0.1 localhost

192.168.1.3 lucy.locallan lucy

Do not add additional hosts to the /etc/hosts file until the command "dnsdomainname" reports the correct value. You do not need to restart the PC for this; you can instead use:

/etc/init.d/hostname restart

/etc/init.d/domainname restart

When the command "dnsdomainname" reports "locallan," you will know that your setup is correct. Note that the command "domainname" will not give you what you want. Once your domain name is working correctly, you can add additional hosts to the /etc/hosts file, making sure that you have not broken anything.

The linux system will in most cases get the current domain name from either 1)your named server, if you are running one -or- 2)/etc/hosts. This is the method used by the standard glibc system call. The fully qualified domainname (in this case, lucy.locallan) will be the first name listed after your IP address (in this case, 192.168.1.3). The hostname is the part of the FQDN before the "." (or lucy) and the domainname is the part of the FQDN after the "." (locallan). Any names listed after this first one (in this case, lucy)are considered aliases and will be textually replaced by the FQDN (lucy.locallan) when you use them.

The files /etc/hostname and /etc/dnsdomainname are not used by anything except the gentoo initscripts to set hostname and domainname, which are redundant as long as the /etc/hosts file is setup correctly. These initscripts exist so that the "localhost" alias works as you expect it to.

-Mike

----------

## fargazer

That did the trick.  I played a bit with it, changing the domain to various things, and I think I am comfortable now with how this works.

Thanks for the detail in your explanation (things like the first name in hosts is the real name, the others are just aliases); it furthers my understanding of the system  :Smile: 

----------

