I have joined an Ubuntu 14.04 machine to domain using samba 4 but auth is not working. Look what I get:

# net ads keytab create -U 'admin'
Enter admin's password:
ads_get_dnshostname: No dNSHostName attribute!
../source3/libads/kerberos_keytab.c:328: unable to determine machine account's dns name in AD! 

Testing if my FQDN is correct I get:

# hostname -d

# domainname

Why does domainname has different behavior than hostname -d? Could this be the problem with Samba?

This is my configuration:

# grep MYPCNAME /etc/hosts       MYPCNAME.dom.forest.int MYPCNAME

and this:

# cat /etc/hostname

Is my configuration correct? How can I troubleshoot this further?

  • if your Host is in Domain u don't need to assign a hostname by manually it will be provided by DNS Jun 2, 2014 at 6:59

3 Answers 3


You got different answer bacouse hostaname give you "name before domain". Command hostname -d give you domain aka DNS domain name.

Your full hostname you will got with command hostname -f

On some way can say hostname + hostname -d = hostname -f

  • Yes I know that, but why does domainname prints (none)? Does it have a different configuration that hostname? What am I doing wrong here? Jun 3, 2014 at 5:48

Use "dnsdomainname", not "domainname":

domainname - show or set system's NIS/YP domain name ... dnsdomainname - show the system's DNS domain name

Source: HOSTNAME(1) ("man domainname")


The manpage explains this quite clearly. Quoting from man hostname:

-d, --domain
                  Display  the  name  of the DNS domain. Don't use the command domainname to get the DNS domain name because it will show the NIS domain name and not the DNS domain name. Use dnsdomainname instead.

So domainname will show the NIS domain name, you need to use dnsdomainname instead.

You must log in to answer this question.

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