Changing HOSTNAME on UCS

Dear Rolando,

I adopted an older system-setup-script for changing the hostname which we used in the past (/usr/lib/univention-system-setup/scripts/) to current needs.
You will find the script attached.

The script will do all relevant steps if changing a linux hostname on a system with kerberos/SSL chains/LDAP and things like that on a UCS dc master (this would be absolutely the same at every other linux I am aware of…).

The following steps are needed:

chmod +x changehostname ucr set newhostname=xyz ./changehostname
Afterwards you will have to re-provision the Samba 4 LDB - in you case, where Samba 4 never was provisioned successfully, this would’ve been necessary anyway:

[code]# UCS 4:
invoke-rc.d samba stop
invoke-rc.d univention-s4-connector stop

UCS 3:

invoke-rc.d samba4 stop
invoke-rc.d univention-s4-connector stop

mv /etc/univention/connector/s4internal.sqlite /etc/univention/connector/s4internal.sqlite.bak
mv /etc/univention/connector/lockingdb.sqlite /etc/univention/connector/lockingdb.sqlite.bak
mv /etc/univention/connector/s4cache.sqlite /etc/univention/connector/s4cache.sqlite.bak
rm /var/lib/univention-connector/s4/*
mv /var/lib/samba/private /var/lib/samba/private_bak

univention-remove univention-samba4 univention-s4-connector

ucr set connector/s4/mapping/group/grouptype=‘false’ connector/s4/mapping/sid_to_s4=‘true’ samba4/provision/primary=‘true’

univention-install univention-s4-connector univention-samba4

ucr unset samba4/provision/primary connector/s4/mapping/sid_to_s4[/code]

For further reference also have a look at:
Re-Provisioning Samba4 on a DC Master

Afterwards all UCS systems in the domain have to be rejoined to update their information about their master:

univention-join

I successfully did this procedure in two environments, consisting of a dc master and a dc backup, each. Please make sure to test everything if it fits your demand.

Kind regards,
Tim
changehostname.sh (22.4 KB)