Share Folder For Openldap Users
In this notes we will setup how to share different-different directory for particular ldap
user. For the personal data storage.
Ldap Server-
1- First Create a directory to store all ldap users share data
# mkdir /Share_Dir
2- Install and Configure NFS Server
# yum install nfs* -y
# vim /etc/exports
/Share_Dir 172.16.10.0/16(rw,sync)
3- Restart Services
# systemctl restart nfs
# systemctl restart rpcbind
# systemctl enable nfs
# systemctl enable rpcbind
Now create folders for ldap users, which will store personal data to their own share
folder.
Our ldap users –
First- "user1"
Second- "user2"
And we want to share different folder for "user1" and "user2".
We are creating two folder first “user1” and second “user2”.
# mkdir /Share_Dir/user1
# mkdir /Share_Dir/user2
Change the ownership of share folder-
Note: - First check your ldap user group id and gid on ldap server
(# ldapsearch -x -LLL "cn=*" -b "ou=users,dc=linuxpert,dc=com")
# chown -R ldap-user_uid:ldap_user_gid /Share_Dir/folder_name
# chown -R 1001:2001 /Share_Dir/user1
# chown -R 1002:2002 /Share_Dir/user2
Ldap Client Side @Ubuntu
# apt-get -y install portmap nfs-common
# /etc/init.d/nscd restart
# mkdir /Share_Dir
# vim /ect/fstab
172.16.10.19:/Share_Dir /Share_Dir nfs rw,hard,intr 0 0
:wq (Save & Quit)
# reboot
Now Login to your ldap user and check your mount folder…
First I’m login to ldap user – user1
user1@Linux-Team:~$ whoami
user1
user1@Linux-Team:~$ ls /Share_Dir/
user1 user2
Create a file in “user1” directory by user1
user1@Linux-Team:~$ touch /Share_Dir/user1/test1
user1@Linux-Team:~$ ls /Share_Dir/user1/
test1
File has been created.
But when we are logging with user1 and trying to create a file or folder in user2
directory...
then it cannot create file , because user1 do not have permission of user2 directory.
user1@Linux-Team:~$ touch /Share_Dir/user2/test2
touch: cannot touch `/Share_Dir/user1/test2': Permission denied
user1@Linux-Team:~$ touch /Share_Dir/test3
touch: cannot touch `/Share_Dir/test3': Permission denied
Login to Second user- user2
user1@Linux-Team:~$ su – user2
Password:
And trying to create, remove files or folder “user1” & “user2’ share folder..
Check the below example-
user2@Linux-Team:~$ touch /Share_Dir/user2/test3
user1@Linux-Team:~$ ls /Share_Dir/user2/
test3
user2@Linux-Team:~$ rm -rvf /Share_Dir/user1/test1
rm: cannot remove `/Share_Dir/user1/test1': Permission denied
Check on server
All users data will be store on “/Share_Dir” Folder…
[root@www ~]# ll /Share_Dir/user1/
total 0
-rw-r--r-- 1 5003 5003 0 Aug 25 17:28 test1
[root@www ~]# ll /Share_Dir/user1/
total 0
-rw-r--r-- 1 5004 5004 0 Aug 25 17:30 test3
-Ashutosh
Openldap Server Configuration without Ldap Migration Tool