Join Linux CENTOS-7 to Microsoft Active Directory Domain.

First lets check our network interfaces by using this command:

[root@cetnos /]# ip addr 

We can see that we get IP address on interface ens33

So lets change this from DHCP to static IP and add the DNS servers, we do it by changing the interface config file.

[root@cetnos /]# vi /etc/sysconfig/network-scripts/ifcfg-ens33 

Please add the Marked lines to your network interface config file.

Now save it by using this command :qw!

Please reboot the server for changes will take effect.

After the system has finish to reboot we need to change one last thing before we join this machine to the domain, please open resolve.conf file by using this command:

[root@cetnos /]# vi /etc/resolv.conf

Make sure that you add your Domain name here and you have the IP address of your DNS servers, don’t forget to save it by using this command :qw!

Now after we finish, we can go on and join this machine to the Domain, we doing it by using this commands.

[root@cetnos /]# yum install sssd realmd oddjob oddjob-mkhomedir adcli samba-common samba-common-tools krb5-workstation openldap-clients policycoreutils-python -y 
[root@centos ~]# realm join --user=administrator
Password for administrator: 

Once this has completed successfully, a computer object will be created in Active Directory in the default computers container as shown below.

Now that our Linux server is a member of the Active Directory domain we can perform some tests. we need to specify the domain name. For example with the ‘id’ command below,

[root@centos ~]# id
uid=1829600500( gid=1829600513(domain groups=1829600513(domain,1829600512(domain,1829600572(denied rodc password replication,1829600519(enterprise,1829600518(schema,1829600520(group policy creator 

We can also SSH in as any domain user from Active Directory with default settings.

Leaving The Domain

If you want to reverse the process and remove yourself from the domain, simply run the ‘realm leave’ command followed by the domain name, as shown below.

[root@centos ~]# realm leave

#Linux #Microsoft

1 view0 comments