I want to setup a GIT server on my Ubuntu machine in the office but I want a domain name for it that I can connect to from Windows machines on the same network. I've read about using Samba or adding the machine to Active Directory but I'm a bit lost with both. All machines are on the same a.b.com domain.

I have modified my hosts file on the Ubuntu machine to show the following: ubuntu ubuntu.a.b.com ubuntu ubuntu.a.b.com ubuntu

I have admin credentials to the domain controllers and Active Directory. What can I do to enable other Windows machines to access the Ubuntu machine for something like SSH or a GIT server via a domain name rather than the machines IP address?


To allow all the Windows machines in the domain to access your Ubuntu machine by domain name, you'll need to get the Ubuntu machine added to the DNS information on the Active Directory servers.

While Windows machines that are members of the AD domain register themselves automatically, you can also edit the DNS records manually using the appropriate Windows DNS administration tool. Initially you'd just need to have an A record like this added in the main (forward lookup) DNS zone of the domain (b.com or possibly a.b.com), as expressed in fully-qualified form in the standard DNS record format:

ubuntu.a.b.com.   IN A

and ideally a corresponding reverse lookup record in the appropriate reverse zone (<reversed-network-IP-address-parts>.in-addr.arpa.):   IN PTR ubuntu.a.b.com.

(The Windows DNS tool might have the option to create the reverse lookup record automatically for you.)

Depending on exactly how your AD domain is configured, and whether your Ubuntu server uses DHCP or static IP assignment, you may have one or two ways to get the Ubuntu machine to register itself to the domain too.

If the Ubuntu machine uses DHCP, you can try adding the necessary configuration options to its DHCP client to ask the domain's DHCP server to handle the registration for you.

Or if the AD domain is configured to accept DNS updates without Kerberos authentication (not so secure!), you might just use the nsupdate command to send an update request directly to the AD DNS service.

If you're using a static IP address, and the AD domain requires authenticated DNS updates, then the only automatic option will be to have the Ubuntu system join the AD domain first. With modern versions of Samba, the DNS registration will happen automatically as you join the domain; with older versions you might have to explicitly request it.

Joining a Linux system to an Active Directory domain can be done in several ways, depending on which version of Samba your Linux distribution has, and whether or not it has the sssd daemon available or not. sssd can greatly simplify the process of joining the AD domain, and it will also automatically handle keeping the domain membership alive so that it won't expire.

If you want to join your Ubuntu system to the AD domain, you should look for instructions written specifically for your particular Ubuntu version, ideally in the official Ubuntu documentation (like here for Ubuntu 18.04 LTS for example). Those should cover the recommended procedure for that particular version of the distribution. If you only read the generic documents for Samba and sssd, you might be overwhelmed by the number of possible combinations of various components and ways to configure them.


You could add an entry for ubuntu.a.b.com to the hosts file on your Windows machine:



If you are going to join your Ubuntu system to an AD domain and wish to use sssd, then stick with 18.04. Ubuntu 18.10 onwards uses a Samba version that must be used with winbind in an AD domain and sssd must not be used.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.