40 lines
1.3 KiB
Bash
40 lines
1.3 KiB
Bash
#!/bin/bash
|
|
|
|
if [ "$EUID" -ne 0 ]; then
|
|
echo "Please run as root"
|
|
exit
|
|
fi
|
|
|
|
if [ -f /etc/debian_version ]; then
|
|
wget -O - http://repo.pbis.beyondtrust.com/apt/RPM-GPG-KEY-pbis|sudo apt-key add -
|
|
wget -O /etc/apt/sources.list.d/pbiso.list http://repo.pbis.beyondtrust.com/apt/pbiso.list
|
|
apt update
|
|
apt install -y pbis-open
|
|
elif [ -f /etc/redhat-release ]; then
|
|
wget -O /etc/yum.repos.d/pbiso.repo http://repo.pbis.beyondtrust.com/yum/pbiso.repo
|
|
yum clean all
|
|
yum install pbis-open
|
|
else
|
|
echo "Unable to determine linux distro"
|
|
exit
|
|
fi
|
|
|
|
# ask for the domain, username, and password
|
|
read -e -p "Enter Domain name: " -i "home.johnhgaunt.com" domain
|
|
read -e -p "Enter netBIOS name: " -i "GAUNT" netbiosname
|
|
read -e -p "Enter Domain Admin username: " -i "jgaunt" username
|
|
read -e -s -p "Enter Password: " password
|
|
|
|
domainjoin-cli join ${domain} ${username} ${password}
|
|
|
|
/opt/pbis/bin/config UserDomainPrefix ${netbiosname}
|
|
/opt/pbis/bin/config AssumeDefaultDomain true
|
|
/opt/pbis/bin/config LoginShellTemplate /bin/bash
|
|
/opt/pbis/bin/config HomeDirTemplate %H/%U
|
|
|
|
echo "## ${domain} Admins ##" >> /etc/sudoers.d/${netbiosname}AD
|
|
echo "# Allow members of ${netbiosname}\Domain Admins group sudo access" >> /etc/sudoers.d/${netbiosname}AD
|
|
echo "%Domain^Admins ALL=(ALL:ALL) ALL" >> /etc/sudoers.d/${netbiosname}AD
|
|
|
|
reboot
|