#! /bin/bash
# Input Suod Password
read -s -p "Input Sudo Password:" PWD
cd
#apt update and install related softwares
echo $PWD |sudo apt -y update
sudo apt -y upgrade
sudo apt -y install realmd libnss-sss libpam-sss sssd sssd-tools adcli samba-common-bin oddjob-mkhomedir packagekit
#Modify Computer Name
read -p "Input Computer Name:" ComputerName
sudo hostnamectl set-hostname $ComputerName
hostnamectl
#Join Domain and Change Configurations
sudo realm discover saic-itech.com
echo "域管理员密码" | sudo realm join -U administrator sh.com
realm list
id administrator@sh.com
sudo sed -i -e 's/use_fully_qualified_names = True/use_fully_qualified_names = False/g' /etc/sssd/sssd.conf
sudo sed -i -e 's/%u@%d/%u/g' /etc/sssd/sssd.conf
sudo sed -i -e '/pam_unix.so/a\session required pam_mkhomedir.so skel=/etc/skel/ umask=0022' /etc/pam.d/common-session
sudo sed -i -e '/%admin ALL=(ALL) ALL/a\%Domain\\ Users ALL=(ALL:ALL) ALL' /etc/sudoers
realm permit -g 'Domain Users'
realm permit -g 'Domain Admins'
sudo reboot
Last modification:March 8, 2024
© Allow specification reprint