• We did not send an email asking for donations - please read this post.

RedHat Linux VM Domain Joining

linuxnaive

New Member
Joined
Jun 15, 2022
Messages
2
Reaction score
0
Credits
27
Hi all, I am new to Linux and need some suggestion on Azure Linux VM (RHEL 7.7) domain joining using bash script. I wrote below script for each steps needed to domain join a linux (rhel) vm. The script seems working fine but, as I am new to linux world, I need advise on below steps and I might be missing any best practice on these configuration especially on step 2, 3 & 6.
Note: I am thinking to implement DR using azure site recovery so as per my understanding I am configuring dynamic dns settings (step 6).

#1# Install required packages
yum install realmd sssd krb5-workstation krb5-libs oddjob oddjob-mkhomedir samba-common-tools -y

#2# Add the DNS suffix to hostname
hostnamectl set-hostname ${HOSTNAME,,}.$DOMAINLOWERCASE

systemctl restart NetworkManager

#3# Add domain to /etc/resolv.conf
cat <<EOF | tee -a /etc/sysconfig/network-scripts/ifcfg-eth0
DOMAIN=$DOMAIN
EOF

systemctl restart NetworkManager

#4# Initialise Kerberos
echo $PASSWORD | kinit [email protected]$DOMAIN

#5# Join the domain
echo $PASSWORD | realm join $DOMAIN -U [email protected]$DOMAIN --computer-ou=$OUPATH --verbose

#6# Dyndns settings and homedir settings
cat <<EOF | sudo tee -a /etc/sssd/sssd.conf
dyndns_update = true
dyndns_refresh_interval = 43200
dyndns_update_ptr = true
dyndns_ttl = 3600
dyndns_auth = gss-tsig
override_homedir = /home/%d/%u
EOF

systemctl restart sssd



Any Suggestion/feedback will be much appreciated. Thanks.
 


f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,944
Reaction score
3,587
Credits
36,026
Having to configure kerberos and other services needed to join a domain the chances are high you will run into something or make mistake and will cost you a load of time to debug. Just use IDM that way you can have your IDM server create a trust with a Windows AD and have your Linux clients talking to your IDM server.
 
Last edited:
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Top