Updated domain join by using sssd conf.d directory
This commit is contained in:
@@ -34,14 +34,25 @@ elif [ "${OS}" == "CentOS" ]; then
|
||||
echo ${password} | realm join --user=${username} --computer-ou=OU=Servers ${domain}
|
||||
fi
|
||||
|
||||
# Get hostname
|
||||
hostname=$(hostnamectl | awk '/Static hostname:/ {print $3}')
|
||||
|
||||
# set the sssd options
|
||||
# don't require the full domain for the usernames
|
||||
sed --in-place 's/^use_fully_qualified_names = True/use_fully_qualified_names = False/' /etc/sssd/sssd.conf
|
||||
# set home directory to /home/<username>
|
||||
sed --in-place 's/^fallback_homedir = \/home\/%u@%d/fallback_homedir = \/home\/%u/' /etc/sssd/sssd.conf
|
||||
# change the provider to simple and then only allow the server admins to login
|
||||
sed --in-place 's/^access_provider = ad/access_provider = simple\nsimple_allow_groups = Server Admins/' /etc/sssd/sssd.conf
|
||||
# set the sssd options for our domain
|
||||
cat <<EOF > "/etc/sssd/conf.d/${netbiosname}.conf"
|
||||
[domain/${domain}]
|
||||
use_fully_qualified_names = False
|
||||
fallback_homedir = /home/%u
|
||||
access_provider = simple
|
||||
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
|
||||
systemctl restart sssd
|
||||
|
||||
Reference in New Issue
Block a user