Debian - any version. Is the hostname a short name or FQDN?

Discussion in 'Installation/Configuration' started by matty, Dec 9, 2023.

  1. matty

    matty Member

    Assuming the example from 'man hostname', the hostname is ursula, the domainname is example.com, and the FQDN is ursula.example.com. In that case, /etc/hostname contains only the word ursula, and /etc/hosts will have a line such as 123.11.22.33 ursula.example.com ursula.

    I've been using Debian since Hamm and have always configured my systems per the above without issues. There are many guides online that recommend this setup. I have a software developer that has released an update that breaks some things that rely on this and to fix it they say the above is ancient and I must set the hostname to the FQDN by either 'hostnamectl set-hostname ursula.example.com' or by editing /etc/hostname to contain ursula.example.com.

    I accept things change over time, but I cannot find any official Debian docs that say this is how things are done now. Please humour me. :)
     
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

  3. till

    till Super Moderator Staff Member ISPConfig Developer

    I think the way you set it up is still the correct way, at leat that's the way e.g. Debian still does it in Debian 12 when you set up Debian using the Debian installer. What's important is that the command:

    hostname -f

    returns the fully qualified hostname. programs that need the FQDN will query it like that. The command hostname without -f option should return the short name.

    Of course, you can use the full hostname in /etc/hostname file as your developer recommended to you. It will work like this too and you likely get no negative side effects following his advice. But if the developer created his software correctly, it should be able to determine what the short hostname and the FQDN are and query the system's fqdn using 'hostname -f' in his software.
     
    matty likes this.
  4. matty

    matty Member

    Thanks till!
     

Share This Page