[SoftNAS KB]: How To Configure Existing AD (for 2008 and up) with NIS Server to SoftNAS Samba
Symptoms
Many Cloud environments use a hybrid of Windows and Linux servers for their hosted applications. Keeping proper ownership between Windows Active Directory/NIS and Linux NFS is vital for security and the operation of applications that depend on proper file user and group ownership.
SoftNAS uses Sernet Samba to accomplish CIFS and Active Directory integration. SoftNAS can also sync these permissions and File Ownerships to NFSv4 Clients running Linux based Operating systems.
Purpose
In the following guide, we will provide step-by-step guidance on how to properly configure an existing Windows 2008/2008R2/2012/2012R2/2016 Active Directory with NIS server to sync users/UID and groups/GID to the SoftNAS Samba CIFS shares. These permissions will also sync to NFSv4 Linux clients that are also joined into the Domain/NIS.
idmap config SOFTNAS0:backend = ad idmap config SOFTNAS0:range = 10000-70000
The example below shows the User Kash Pande with UID 10005, login shell, Home Directory, and Primary Group GID 10005.
This will need to be set for all users that will need to be synced to the SoftNAS Server.
This screenshot shows the Adding of the Unix Attribute for the Domain Users:
This Screenshot shows the UID and GID of another User:
root@SoftNAS:~# getent passwd | grep SOFTNAS0
SOFTNAS0/kash:*:10005:10000:Kash Pande:/example/home/kash:/bin/ksh
And to see GID’s Mapped:
root@SoftNAS:~ # getent group | grep SOFTNAS0
SOFTNAS0/domain admins:x:10001:
SOFTNAS0/domain users:x:10000:
root@SoftNAS:/tank/vol1# touch testfile
root@SoftNAS:/tank/vol1# ls -l
total 2
drwxrwxrwx 2 root root 3 Dec 19 11:39 .
drwxrwxrwx 3 root root 3 Dec 12 10:57 ..
-rw-r--r-- 1 root root 0 Dec 19 11:49 testfile
root@SoftNAS:/tank/vol1# chown "SOFTNAS0/kash:SOFTNAS0/domain users" testfile
root@SoftNAS:/tank/vol1# ls -l
total 2
drwxrwxrwx 2 root root 3 Dec 19 11:39 .
drwxrwxrwx 3 root root 3 Dec 12 10:57 ..
-rw-r--r-- 1 SOFTNAS0/kash SOFTNAS0/domain users 0 Dec 19 11:49 testfile
# mount -vt nfs -o vers=4 192.168.193.135:tank/vol1 /mnt
mount.nfs: timeout set for Mon Dec 19 11:04:21 2016
mount.nfs: trying text-based options 'vers=4,addr=192.168.193.135,clientaddr=192.168.193.221'
# cd /mnt
# ls -l
total 2
drwxrwxrwx 2 root root 3 Dec 19 11:39 .
drwxrwxrwx 3 root root 3 Dec 12 10:57 ..
-rw-r--r-- 1 10005 10000 0 Dec 19 11:49 testfile
root@NFSCLIENT:~# getent passwd | grep SOFTNAS0
SOFTNAS0/kash:*:10005:10000:Kash Pande:/example/home/kash:/bin/ksh
And to see GID’s Mapped:
root@NFSCLIENT:~ # getent group | grep SOFTNAS0
SOFTNAS0/domain admins:x:10001:
SOFTNAS0/domain users:x:10000:
And we can see the proper RFC2307 information:
# mount -vt nfs -o vers=4 192.168.193.135:tank/vol1 /mnt
mount.nfs: timeout set for Mon Dec 19 11:04:21 2016
mount.nfs: trying text-based options 'vers=4,addr=192.168.193.135,clientaddr=192.168.193.221'
# cd /mnt
# ls -l
total 2
drwxrwxrwx 2 root root 3 Dec 19 11:39 .
drwxrwxrwx 3 root root 3 Dec 12 10:57 ..
-rw-r--r-- 1 SOFTNAS0/kash SOFTNAS0/domain users 0 Dec 19 11:49 testfile
The NFSv4 Clients can use AD, or use RPCIDMAPd to sync NFSv4 files however, the /etc/passwd and /etc/group files must contain entries that resemble the ‘getent passwd/getent group” commands used to check UID’s and GID’s in previous steps.
You can now add Users and Groups to the CIFS Access and Control: https://www.softnas.com/docs/softnas/v3/html-reference-guide/configuring_cifs_shares.html