User Tools

Site Tools


join_ubuntu_to_active_directory

Join Ubuntu to Active Directory

adPrep.sh
# Install prerequisite packages
 
sudo apt update
sudo apt full-upgrade
sudo apt install -y realmd sssd sssd-tools libnss-sss libpam-sss krb5-user adcli samba-common-bin
 
# Collect information from the user
 
echo "I need information about your domain to continue. Be prepared to provide credentials for a domain administrator."
 
read -p "Please enter the username for a domain administrator: " domainAdmin
read -sp "Please enter the domain administrator's password: " domainAdminPassword
read -p "Please enter the full domain name: " domainName
read p "Please enter the group name that should have sudo rights on this machine. You can add others later using visudo: " domainSudoers
 
# Discover and confirm the domain
 
realm discover $domainName
 
echo "Is this information correct?"
select yn in "Yes" "No"; do
    case $yn in
        Yes ) realm join -U $domainAdmin $domainName;;
        No ) read -p "Please enter the full domain name: " domainName;;
    esac
done
 
# Join the domain
 
# Configure sudoers
join_ubuntu_to_active_directory.txt · Last modified: 2019/05/15 14:48 by john