Updated domain join by using sssd conf.d directory

This commit is contained in:
2025-08-21 02:21:50 +00:00
parent 94b46ad204
commit bd4875a906

View File

@@ -34,14 +34,25 @@ elif [ "${OS}" == "CentOS" ]; then
echo ${password} | realm join --user=${username} --computer-ou=OU=Servers ${domain} echo ${password} | realm join --user=${username} --computer-ou=OU=Servers ${domain}
fi fi
# Get hostname
hostname=$(hostnamectl | awk '/Static hostname:/ {print $3}')
# set the sssd options # set the sssd options for our domain
# don't require the full domain for the usernames cat <<EOF > "/etc/sssd/conf.d/${netbiosname}.conf"
sed --in-place 's/^use_fully_qualified_names = True/use_fully_qualified_names = False/' /etc/sssd/sssd.conf [domain/${domain}]
# set home directory to /home/<username> use_fully_qualified_names = False
sed --in-place 's/^fallback_homedir = \/home\/%u@%d/fallback_homedir = \/home\/%u/' /etc/sssd/sssd.conf fallback_homedir = /home/%u
# change the provider to simple and then only allow the server admins to login access_provider = simple
sed --in-place 's/^access_provider = ad/access_provider = simple\nsimple_allow_groups = Server Admins/' /etc/sssd/sssd.conf simple_allow_groups = Domain Admins, Server Admins
ad_hostname = ${hostname}.${domain}
dyndns_update = true
dyndns_refresh_interval = 43200
dyndns_update_ptr = true
dyndns_ttl = 3600
EOF
# make sure the permissions are correct
chmod 600 "/etc/sssd/conf.d/${netbiosname}.conf"
# reboot sssd # reboot sssd
systemctl restart sssd systemctl restart sssd