How can the NETBIOS domain name be changed?

In this example the NETBIOS domain name is changed from DOM to NEWDOM. The values have to be adapted to your environment.

If you haven’t installed UCS already, have a look at this article.

Scenario 1: UCS is already installed, but Samba 4 (Active Directory Domain Services) is not installed

We assume you already installed UCS, but need to explicitly set a NetBIOS name before the installation of Samba AD:

eval "$(ucr shell)"
udm settings/sambadomain modify --dn sambaDomainName=DOM,cn=samba,$ldap_base --set name=NEWDOM
ucr set windows/domain=NEWDOM
univention-app install samba4

Scenario 2: UCS is already installed with Samba 4 (Active Directory Domain Services)

In a UCS domain with Samba 4 (Active Directory Domain Services) already installed, the following steps are required in order to change the NETBIOS domain name.

1. First of all, the Samba domain objects must be changed on the UCS Domain controller master:

eval "$(ucr shell)"
udm settings/sambadomain modify --dn sambaDomainName=DOM,cn=samba,$ldap_base --set name=NEWDOM

2. On every Samba 4 Domain Controller the following commands have to be executed:

eval "$(ucr shell)"
ldbmodify -H /var/lib/samba/private/sam.ldb.d/CN=CONFIGURATION,$samba4_ldap_base.ldb <<-%EOF
dn: CN=DOM,CN=Partitions,CN=Configuration,$samba4_ldap_base
changetype: modify
replace: nETBIOSName
nETBIOSName: NEWDOM
%EOF

ldbrename -H /var/lib/samba/private/secrets.ldb "flatname=DOM,cn=Primary Domains" "flatname=NEWDOM,cn=Primary Domains"

3. Afterwards , the NETBIOS domain name must be changed in the configuration files on every Samba domain controller. Please use /etc/init.d/samba-ad-dc instead of /etc/init.d/samba on UCS 3 systems:

ucr set windows/domain=NEWDOM
/etc/init.d/samba restart

4. If UCS member servers are used with Samba services, the following commands should be run on every UCS member server:

ucr set windows/domain=NEWDOM
net ads join -U Administrator
/etc/init.d/samba restart
/etc/init.d/winbind restart

If you’re setting up a new installation, see this article for how to set the domain name during the installation which is much easier than changing it afterwards.

Mastodon