|
| 1 | +# Joining Centos7 server to domain** |
| 2 | + |
| 3 | +### Prepping the server |
| 4 | + |
| 5 | +_Guide followed [here](https://www.tecmint.com/integrate-centos-7-to-samba4-active-directory/)_ |
| 6 | + |
| 7 | +Install OS, assign static IP address |
| 8 | + |
| 9 | +Configure local DNS (/etc/resolv.conf) to point to the new AD DC |
| 10 | +``` |
| 11 | +search tobias.local |
| 12 | +nameserver 10.0.2.201 |
| 13 | +``` |
| 14 | + |
| 15 | +Edit host file and add an IP address entry with the hostname and FQDN |
| 16 | +``` |
| 17 | +127.0.0.1 localhost localhost.tobias.local |
| 18 | +::1 localhost localhost.tobias.local |
| 19 | +10.0.2.203 tobiasrh01 tobiasdc01.tobias.local |
| 20 | +``` |
| 21 | + |
| 22 | +Run the following to update hostname |
| 23 | +``` |
| 24 | +hostnamectl set-hostname tobiasdc01 |
| 25 | +``` |
| 26 | + |
| 27 | +Reboot |
| 28 | + |
| 29 | +Install and configure NTP to sync with the domain controller |
| 30 | +``` |
| 31 | +yum install ntp |
| 32 | +ntpdate tobias.local |
| 33 | +``` |
| 34 | + |
| 35 | +Install the required packages |
| 36 | +``` |
| 37 | +yum -y install authconfig samba-winbind samba-client samba-winbind-clients |
| 38 | +``` |
| 39 | + |
| 40 | +We can use a nice little GUI to join the domain |
| 41 | +``` |
| 42 | +authconfig-tui |
| 43 | +``` |
| 44 | + |
| 45 | +At the first prompt screen make sure the following are selected |
| 46 | +``` |
| 47 | +Use Winbind |
| 48 | +Use Shadow Password |
| 49 | +Use Winbind Authentication |
| 50 | +Local authorization is sufficient |
| 51 | +``` |
| 52 | + |
| 53 | +On the second prompt screen fill in as following |
| 54 | +``` |
| 55 | +Security Model: ads |
| 56 | +Domain = TOBIAS |
| 57 | +Domain Controllers = tobiasdc01.tobias.local,tobiasdc02.tobias.local |
| 58 | +ADS Realm = TOBIAS.LOCAL |
| 59 | +Template Shell = /bin/bash |
| 60 | +``` |
| 61 | + |
| 62 | +_----- Optional -----_ |
| 63 | + |
| 64 | +We can join the domain without a GUI utility, however this can be prone to typos ect |
| 65 | + |
| 66 | +authconfig --enablewinbind --enablewinbindauth --smbsecurity ads --smbworkgroup=TOBIAS --smbrealm TOBIAS.LOCAL --smbservers=tobiasdc01.tobias.local,tobiasdc02.tobias.local --krb5realm=TOBIAS.LOCAL --enablewinbindoffline --enablewinbindkrb5 --winbindtemplateshell=/bin/bash--winbindjoin=Administrator --update --enablelocauthorize --savebackup=/backups |
| 67 | + |
| 68 | +_----- Optional -----_ |
| 69 | + |
| 70 | +### Testing and verifying the config |
| 71 | + |
| 72 | +We can verify if the winbind service is running by using the following command |
| 73 | +``` |
| 74 | +systemctl status winbind.service |
| 75 | +``` |
| 76 | + |
| 77 | +Edit the local "smb.conf" found in "/etc/samba/smb.conf" and make sure the following are set at the end of the "[global]" configuration |
| 78 | +``` |
| 79 | +winbind use default domain = true |
| 80 | +winbind offline logon = true |
| 81 | +``` |
| 82 | + |
| 83 | +To make sure local home directories are created run the following |
| 84 | +``` |
| 85 | +authconfig --enablemkhomedir --update |
| 86 | +``` |
| 87 | + |
| 88 | +Finally restart winbind |
| 89 | +``` |
| 90 | +systemctl restart winbind |
| 91 | +``` |
| 92 | + |
| 93 | +Log off the server and then try and log back in with a domain user. |
0 commit comments