ALL LINUX
  • Linux 4 Network Engineers
  • Introduction
    • Untitled
  • LINUX - "HOW-TO-DO"
    • SYSADMIN
      • MONITORING
        • Stress Testing Linux
      • DEBIAN APT
      • DISK
        • Directory Share - NFS,CIFS
        • LOGICAL VOLUME MANAGEMENT (LVM)
        • FILE SYSTEMS
          • ZFS
      • FIND & DU
      • SECURITY
        • SSH Open Format
      • USERS
        • Accounts, Groups etc
        • Assess User Activity
    • SCRIPTING & TEXT EDIT
      • BASH SCRIPTING & PROJECTS
        • 1) How to Build a Bash Script
        • 2) Variables & Shell Expansions
        • 3) Processing Command Lines
        • 4) Requesting User Input
      • VIM Editor
        • Vim Tips
      • GREP, EGREP & REGEX
        • REGEX
        • REGEX2
        • NINJA-REGEX
      • SED and AWK
  • Containers
    • MULTIPASS
    • LXD LXC
    • KUBERNETES (K8's)
  • FOSS
    • CUMULUS LINUX
      • Fundamentals
        • Cumulus Linux Introduction
        • Cumulus Linux Architecture
        • Cumulus VX
        • Initial Setup
      • NCLU
  • Linux Prof Inst Cert [LPIC-1]
    • LPIC 1
      • CH1-Linux Command-Line Tools
        • Work on the Command Line
        • Streams, Pipes and Redirects
          • Text Streams Using Filters
        • Search Text Files - Regular Expressions
        • Basic File Editing
      • CH2-Managing software and Processes
      • Ch3-Configuring Hardware
      • Ch4-Managing Files
      • Ch5-Booting, Initialising and Virtualising Linux
Powered by GitBook
On this page
  • Network File System (NFS)
  • Configure and Install on Linux (Ubuntu 20.04)
  • Server:

Was this helpful?

  1. LINUX - "HOW-TO-DO"
  2. SYSADMIN
  3. DISK

Directory Share - NFS,CIFS

Network File Share (NFS) and Common Internet File Share (CIFS) are both use for directory sharing. One purely between UNIX/Linux systems (NFS) and the other between UNIX/Linux and Windows Systems (CI

Network File System (NFS)

NFS was introduced by Sun Microsystems and is used between UNIX/Linux Systems for directory/file sharing and uses port

Configure and Install on Linux (Ubuntu 20.04)

Server:

Step 1: Install NFS software

Install the nfs-kernel-server package onto the server. We need to update the system packages before we install:

sudo apt update

sudo apt install nfs-kernel-server

Step 2: Create a NFS Export Directory

Create a directory that will be shared among all client members. This is also known as the 'export directory' To restrict access to these files we will add the respective users to the specific groups for that share.

sudo mkdir -p /mnt/nfs-share

Step 3: Create Groups, Add Users To Groups and Change Permissions

  • We will now create a group that the users will belong to to access the files within the shared NFS directory

    sudo groupadd nfs_share

  • To list all the groups we can use the cat /etc/group command

  • We will now create a user and add that user to the group. We don't want the users to be able to login to the server using ssh (ie no shell) and having a home directory

  • They must just be able to access the shared directory by their username and that username belonging to the nfs-share group.

  • We normally user the command adduser <user> command which will create a user and home directory,but if we use the sudo useradd -M james.smith --shell /bin/false command and we can create a user without a home directory and no shell

    sudo useradd -M james.smith --shell /bin/false

    sudo passwd james.smith

  • We want users to belong to the nfs_share group, so we add them using the 'usermod -aG' command which ammends their username to the group G

    sudo usermod -aG nfs_share james.smith

  • We need to change the permissions on the "export directory" we created above:

    sudo chown -R nobody:nfsshare /mnt/nfsshare

    sudo chmod -R 770 /mnt/nfs_share

S

PreviousDISKNextLOGICAL VOLUME MANAGEMENT (LVM)

Last updated 3 years ago

Was this helpful?