Centos 7 – Setup Samba Share with Domain Authentication

samba file share

Introduction

Samba is an Linux tool that allows you to create seamless file and printer sharing to SMB/CIFS clients from a Linux server/desktop. With Samba you can even connect that Linux machine to a Windows Domain.

Preparation

To get started you’ll need the following

  • A Domain Controller – We won’t cover how to setup a domain controller here. We assume that you already have a domain controller in our network.
  • A Linux Server running Centos 7 – Most of the work will be done here
  • A Windows PC – This will be used to test access to the shared folder

Update and install Packages

Will start with updating the packages

Configure RAID Block Device

We need to configure RAID on the devices that we are going to use for storage. in our case, we have 12 X 8TB disks that we’ll configure software RAID 5. The effective capacity should be approx  [TOTAL RAW CAPACITY  – SINGLE DISK CAPACITY]  – i.e  96TB – 8TB~= 88TB

Run lsblk to view the list of devices available

We need to write a short script that will convert the disks to gpt

Add the following commands to the script. Replace the device names, i.e sdx with your available device names

Configure raid on the devices. Replace the device names, i.e sdx with your available device names

Format the block device using a preffered file system. e.g xfs

Create a directory to mount the filyesytem

Edit fstab and mount the filesystem

Check to confirm the block device is mounted

Before we proceed with setting up samba share, ensure selinux is set to permissive mode and firewall is stopped and disabled.

Disable Firewalld and Selinux

Update your timezone.

Configure Samba

Switch to samba config directory

Update the file smb.conf as below

Change the following to the ones that apply to your environment

Configure Kerberos

Update /etc/krb5.conf and change the following sections

Update the file /etc/nsswitch.conf to append winbind to passwd and group

 

Start and Enable Services

Start and enable the following services

Have your domain controller Administrator user credentials ready before proceeding to the next step.

Open your network config file and change the primary DNS server to your domain controller(Assuming the same server is the DNS server) or the DNS server os your network.

Join Server to the Domain

Join the server to Active Directory Domain

Enter administrator password to authenticate

Show ad users info

Show domain groups info

You can now set acls and permissions on the share directory

To test accessing the samba share on windows, simple open run prompt and type in the IP address of the server. e.g \\192.168.10.3

 

 

The following two tabs change content below.

harun

Harun is a System Administrator with proficient knowledge in cloud technologies such as KVM, Cloudstack, Citrix Xen Server, Openstack and VMware Vsphere Suite, Ceph, NFS, ISCSI

Latest posts by harun (see all)

About harun

Harun is a System Administrator with proficient knowledge in cloud technologies such as KVM, Cloudstack, Citrix Xen Server, Openstack and VMware Vsphere Suite, Ceph, NFS, ISCSI

Leave a Reply

Your email address will not be published. Required fields are marked *