Samba AD on CentOS7: Difference between revisions

From SambaWiki
Line 101: Line 101:
*Check network.
*DNS is OK?
*Check DNS.
*Date and time are OK?
*Chech Time and Date.

Revision as of 12:49, 20 August 2015

This page describe Samba4 Active Directory installation on CentOS. The environment is composed of 2 DCs with replication, and one fileserver.



The installation is based on CentOS7 Minimal ISO, you should update the system, and install basic tools.

yum update
yum install -y vim wget


This pre-setup can be done in all 3 servers, basically it will setup the Sernet Samba Repository and install samba from repo.

chmod +x

DC1 Setup

First of all we need a domain, so lets provision it.

samba-tool domain provision --use-rfc2307 --interactive

DC2 Setup

Setup kerberos, you can use the as dc1.

scp /etc/krb5.conf

Join as DC.

samba-tool domain join DC -Uadministrator

Fix DNS if it was not created automatically:

samba-tool dns add dc1 dc2 A <IP-OF-DC2> -Uadministrator

After couple minutes, we can see the replication:

samba-tool drs showrepl

Post Setup

This post setup will configure the services to startup and disable Selinux and Firewall, during my tests firewalld did not save the allowed ports, even with permanent flag, so I´v decided to disable to avoid problems.

chmod +x

Fileserver Setup

The pre-setup is the same, but we are not going provision neither join, the fileserver will be just a member of domain. CentOS bring us a useful tool to do it, actually we are going to setup authentication and join the domain in one shot.

Prep, auth and join

Lets start testing our DNS:

host -t SRV has SRV record 0 100 389

Setup auth and join the domain:


Ignore DNS error, you have to create DNS host A manually, at this point you can use windows interface to do that.
Hide domain name:

authconfig --enablewinbindusedefaultdomain --update

Se domain info and users:

net ads info
wbinfo -u
wbinfo -g

Grant rights to domain admins change disk permissions:

net rpc rights grant 'domain admins' SeDiskOperatorPrivilege -U'administrator' -I

Services configuration

Here there is a TODO, you can map what you need to set on Selinux, or disable it:

setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

Setup samba start mode

sed -i 's/SAMBA_START_MODE="none"/SAMBA_START_MODE="classic"/g' /etc/default/sernet-samba

Add followinf lines at end of [global] section on /etc/samba/smb.conf

vfs objects = acl_xattr
map acl inherit = Yes
store dos attributes = Yes

Restart services

systemctl restart sernet-samba-smbd
systemctl restart sernet-samba-nmbd
systemctl restart sernet-samba-winbindd

Configurte startup

chkconfig sernet-samba-nmbd on
chkconfig sernet-samba-smbd on
chkconfig sernet-samba-winbindd on


Add share on sbm.conf

  path = /storage/share
  read only = no

Reload samba:

systemctl reload sernet-samba-smbd

Restric permissions:

chmod -Rf 770 /storage/share
chown administrator:"domain admins" /storage/share

Set ACL to domain admins can chance permissions.

setfacl -m default:group:"domain admins":rwx /storage/share

Windows Management Tools



  • Check network.
  • Check DNS.
  • Chech Time and Date.