Update ad-join-script.sh

Add the support for AD group in sudoer file
This commit is contained in:
jeanGaston 2024-01-31 11:39:56 +01:00 committed by GitHub
parent 002950a041
commit e0d142fc06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,6 +9,7 @@ read -p "Administrator username (AdminUser): " admin_user
read -s -p "Administrator password: " admin_password
echo # To move to the next line
read -p "Active Directory domain name: " domain_name
read -p "Active Directory group for sudo access: " ad_group
# Prompt for DNS server IP and verify DNS resolution
while true; do
@ -54,6 +55,8 @@ systemctl restart sssd
# Add the user to the sudoers file
echo "Adding the user to the sudoers file..."
echo "$admin_user ALL=(ALL:ALL) ALL" | sudo tee -a /etc/sudoers
echo "Adding the group to the sudoers file..."
echo "%$ad_group ALL=(ALL:ALL) ALL" | sudo tee -a /etc/sudoers
# Verify successful domain join by looking up the user
echo "Verifying domain join..."