Joining Debian 8 to Active Directory

# This script should join Debian Jessie (8) to an Active Directory domain.
echo "Please authenticate with your sudo password"
sudo -v
if ! $(sudo which realmd 2>/dev/null); then
    sudo aptitude install realmd adcli sssd
if ! $(sudo which ntpd 2>/dev/null); then
    sudo aptitude install ntp
sudo mkdir -p /var/lib/samba/private
echo "Please enter the domain you wish to join: "
echo "Please enter a domain admin login to use: "
read ADMIN
sudo realm join --user=$ADMIN $DOMAIN
if [ $? -ne 0 ]; then
    echo "AD join failed.  Please run 'journalctl -xn' to determine why."
    exit 1
sudo systemctl enable sssd
sudo systemctl start sssd
echo "session required skel=/etc/skel/ umask=0022" | sudo tee -a /etc/pam.d/common-session
# configure sudo
sudo aptitude install libsss-sudo
echo "%domain\ admins@$DOMAIN ALL=(ALL) ALL" | sudo tee -a /etc/sudoers.d/domain_admins
echo "The computer is joined to the domain.  Please reboot, ensure that you are connected to the network, and you should be able to login with domain credentials."

Alguns links sobre LTSP