Storage

Configure NFS Share for Group Collaboration

Share on Social Media

In this configuration guide, you will learn, how to configure NFS share for Group Collaboration. #centlinux #linux #nfs

What is NFS Share?

NFS stands for Network File System, a protocol that allows you to share directories and files over a network. An NFS share refers to a directory or file system that is shared over a network using the NFS protocol, making it accessible to other computers and devices.

Key Concepts

  1. Network File System (NFS):
    • Definition: A protocol developed by Sun Microsystems that allows files to be shared between systems over a network.
    • Purpose: Facilitates file access and management as if the files were stored on the local machine.
  2. NFS Share:
    • Definition: A directory or file system that is made available over the network using NFS.
    • Function: Enables multiple systems to access and work with files on a server from different client machines.

What is NFS Share for Group Collaboration?

A Collaborative share is a directory that has been shared across the network and a specific group of users have permissions to access, create and modify files on that directory. Usually, a collaborative directory is specific to a Project and rights have been given to the working users.

We have already configured NFS shares and Kerberized NFS shares in our previous posts. Now, we will create an NFS share for group collaboration.

Recommended Online Training: Learn Bash Shell in Linux for Beginners

Configure NFS Share

To configure NFS Service, we have to install nfs-utils package. Usually, this package is automatically installed during installation of Red Hat Enterprise Linux (RHEL) 7. However, you can install it anytime from yum repository.

# yum install -y nfs-utils

nfs-utils is already installed on our system.

Create a directory to share with other clients.

# mkdir /nfsshare
# chgrp dba /nfsshare/
# chmod 2770 /nfsshare/

We have created a directory /nfsshare, change its user-group to dba and 2770 rights has been given to user-group. So, the group-members can create files on this shared directory.

Adjust SELinux type of the /nfsshare directory.

# semanage fcontext -a -t nfs_t "/nfsshare(/.*)?"
# restorecon -Rv /nfsshare/
restorecon reset /nfsshare context unconfined_u:object_r:default_t:s0->unconfined_u:object_r:nfs_t:s0

If semanage command does not available on your system then install policycoreutils-python package.

Now export/share this directory to specific clients.

# echo '/nfsshare *.example.com(rw,sync)' >> /etc/exports
# exportfs -r

Enable and start the nfs-server service.

# systemctl start nfs-server ; systemctl enable nfs-server
ln -s '/usr/lib/systemd/system/nfs-server.service' '/etc/systemd/system/nfs.target.wants/nfs-server.service'

Allow nfs and other required services through firewall.

# firewall-cmd --permanent --add-service={mountd,nfs,rpc-bind}
success
# firewall-cmd --reload
success

Mount NFS Share

Connect to the client2.example.com and install nfs-utils package.

# yum install -y nfs-utils

Create a directory, to mount the shared directory from ipaserver.example.com.

# mkdir /mnt/nfsshare

Check the shared directories from ipaserver.example.com.

# showmount -e ipaserver.example.com
Export list for ipaserver.example.com:
/nfsshare *.example.com

Persistently mount this shared directory by adding following entry in /etc/fstab.

# echo 'ipaserver.example.com:/nfsshare /mnt/nfsshare nfs defaults,_netdev 0 0' >> /etc/fstab
# mount -a

Check the status of mounted directory.

# mount | grep nfsshare
ipaserver.example.com:/nfsshare on /mnt/nfsshare type nfs4 (rw,relatime,vers=4.0,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.116.202,local_lock=none,addr=192.168.116.200,_netdev)

Login with user which is member of the dba group. and create a file in this shared directory, to verify the file permissions.

# su - imran
Last login: Wed Aug  1 08:29:23 PDT 2018 on pts/0
$ cd /mnt/nfsshare/
$ touch test2
$ ls -al
total 0
drwxrws---. 2 root      dba       30 Aug  1 08:34 .
drwxr-xr-x. 4 root      root      31 Jul 31 07:23 ..
-rw-rw-r--. 1 imran     dba        0 Aug  1 08:34 test2

We have successfully provided a network share for group collaboration and persistently mount it on one client.

If you are new to Linux and facing difficulty in working at Linux Bash prompt. We recommend that, you should read The Linux Command Line, 2nd Edition: A Complete Introduction by William Shotts.

Conclusion

In this configuration guide, you have learned, how to configure NFS share for Group Collaboration.

Alaric Bird

Alaric Bird is a seasoned Linux System Administrator with over a decade of experience in managing and optimizing Linux-based servers and infrastructure. Known for his expertise in server deployment, security hardening, and performance tuning, Alaric has a deep understanding of various Linux distributions, including Ubuntu, CentOS, and Red Hat Enterprise Linux. His skills extend to cloud platforms like AWS, where he effectively manages virtual private servers and services. Alaric is also proficient in scripting languages such as Bash and Python, which he uses to automate routine tasks, enhancing efficiency and reliability. With a strong commitment to continuous learning, he stays updated with the latest developments in open-source technologies and best practices. His problem-solving abilities, combined with excellent communication skills, make him a valuable asset to any IT team. In addition to his technical expertise, Alaric is passionate about mentoring junior administrators and fostering a collaborative environment.

Share
Published by
Alaric Bird

Recent Posts

Change Apache Document Root in Linux

Learn how to change Apache document root in Linux by following this step-by-step guide. Adjust…

2 weeks ago

How to Change Apache Port in Linux

Discover how to change Apache port in Linux easily. Follow our simple guide to modify…

2 weeks ago

How to Create Virtual Host in Apache Server

Learn how to create a virtual host in Apache Server with this comprehensive guide. Set…

3 weeks ago

10 Practical Tasks for RHCSA Exam with Solutions

Discover 10 practical tasks for the RHCSA exam with step-by-step solutions. Boost your Linux skills…

3 weeks ago

Ultimate Fail2ban Configuration Guide

Discover the ultimate Fail2ban configuration guide. Learn how to set up, customize, and optimize Fail2ban…

3 weeks ago

VPS Server: The Ultimate Guide to Virtual Private Servers

Explore the ultimate guide to VPS servers and learn everything about Virtual Private Servers, including…

4 weeks ago

This website uses cookies.