Add clear-net-cache.sh to install-fileserver-as-dc-member.sh

This commit is contained in:
Johan 2024-01-27 12:48:24 +01:00
parent 403610a643
commit fd1961c0c2

View File

@ -156,6 +156,17 @@ sudo tee /etc/security/pam_winbind.conf > /dev/null <<EOL
debug = no
EOL
sudo tee /usr/local/bin/clear-net-cache.sh > /dev/null <<EOL
service winbind stop
service smbd stop
net cache flush
rm /var/lib/samba/*.tdb
service smbd start
service winbind start
EOL
chmod ugo+rwx /usr/local/bin/clear-net-cache.sh
echo "Rejoining domain..."
# kinit $ADMINUSER@${DCREALM,,}
net ads join -U $ADMINUSER -S ${DCHOSTNAME,,}.${DCREALM,,}
@ -165,12 +176,7 @@ smbcontrol smbd reload-config
systemctl restart winbind
# Clear Winbind cache
service winbind stop
service smbd stop
net cache flush
rm /var/lib/samba/*.tdb
service smbd start
service winbind start
/usr/local/bin/clear-net-cache.sh
echo "Found admin user:"
getent passwd ${WORKGROUP^^}\\$ADMINUSER