Logo ← PostgreSQL Blog

Mounting Remote File Systems on RHEL 9: Using CIFS for Windows, NFS for Linux

In this article, I combine three important topics into a single, in-depth guide to help system administrators working on Red Hat Enterprise…

Mounting Remote File Systems on RHEL 9: Using CIFS for Windows, NFS for Linux

In this article, I combine three important topics into a single, in-depth guide to help system administrators working on Red Hat Enterprise Linux (RHEL) 9 systems integrate seamlessly with Windows File Servers:

  1. How to mount Windows shares using CIFS/SMB on RHEL 9
  2. How to mount NFS Share from a Linux Server on RHEL 9
  3. A complete comparison between CIFS/SMB vs NFS to help you choose the right protocol for your use case

Whether you’re working in a hybrid Linux-Windows environment or trying to ensure efficient file-sharing across platforms, this guide is for you.

Part 1: Mounting a Windows File Server Share on RHEL 9 using CIFS

CIFS (Common Internet File System), also known as SMB (Server Message Block), is the standard protocol for Windows-based file and printer sharing. On Linux systems like RHEL 9, cifs-utils allows access to these shares.

Step 1: Install Required Packages

dnf install cifs-utils
dnf install gettext  # Often pre-installed, but include if missing
  • cifs-utils: Enables mounting and managing CIFS shares.
  • gettext: Provides necessary localization utilities.

Step 2: (Optional) Disable SELinux Temporarily

Sometimes SELinux might block CIFS mounts. For troubleshooting:

getenforce         # Check current mode
setenforce 0       # Set to permissive temporarily

To disable SELinux permanently (not recommended in production):

vi /etc/selinux/config
# Change SELINUX=enforcing to SELINUX=disabled
Note: It’s always better to configure proper SELinux policies rather than disabling it completely.

Step 3: Create a Dedicated User and Group

useradd kemal
passwd kemal
groupadd dba
usermod -aG dba kemal

Step 4: Set User Limits (Optional for Production Systems)

Edit /etc/security/limits.conf:

kemal  soft  nproc  1024
kemal  hard  nproc  1024
kemal  soft  nofile 1024
kemal  hard  nofile 1024

Step 5: Create Mount Point and Mount the CIFS Share

mkdir -p /CBS/VTYS_BACKUP
mount -t cifs //mavidepo1.itu.gov.tr/CografiBilgiSistemi/VTYS_BACKUP /CBS/VTYS_BACKUP -o username=kemal.oz

Add -o domain=YOURDOMAIN and other options if needed.

Step 6: Verify the Mount

df -h

Step 7: Make It Persistent with fstab

Create credentials file:

vi /etc/cifs-credentials

user=kemal.oz
password=YourPassword
domain=BIM

Secure the file:

chmod 600 /etc/cifs-credentials

Edit /etc/fstab:

//mavidepo1.itu.gov.tr/CografiBilgiSistemi/VTYS_BACKUP /CBS/VTYS_BACKUP cifs credentials=/etc/cifs-credentials,uid=kemal,gid=kemal,dir_mode=0750,file_mode=0750 0 0

Apply the changes:

mount -a
df -h

Step 8: Unmount When Done

umount /CBS/VTYS_BACKUP

Part 2: Mounting an NFS Share from a Linux Server on RHEL 9

NFS is a native Unix/Linux protocol, often preferred in Linux-to-Linux communication, but can also be enabled on Windows Server.

Step 1: Install NFS Utilities

dnf install nfs-utils

Step 2: Create Local Mount Directory

mkdir -p /dba/backups

Step 3: Mount the NFS Share

sudo mount -t nfs saridepo3:/nfscbsdbbackup /dba/backups

Verify:

df -h

Step 4: Make NFS Mount Persistent

Edit /etc/fstab:

saridepo3:/nfscbsdbbackup /dba/backups nfs port=2049,rw,bg,hard,nointr,tcp,actimeo=0,vers=3,timeo=600 0 0

Mount and verify:

mount -a
df -h

Step 5: Unmount NFS Share

umount /dba/backups

Part 3: NFS vs CIFS — Which One Should You Use?

Feature NFS CIFS/SMB Best for Linux/Unix systems Windows environments Performance High (native support in Unix/Linux) May be slower on Linux Security Can use Kerberos, firewall friendly Supports NTLM/AD, encrypted transport Compatibility Less friendly to Windows clients Seamless integration with Windows Setup Simple on Linux, advanced options exist More options for AD, group policies etc.

Final Thoughts

  • Use NFS if you’re working in a predominantly Linux/Unix environment and need performance.
  • Use CIFS/SMB if you’re integrating with Active Directory, or working with shared folders on Windows.
  • For hybrid environments, test both protocols and monitor performance, security, and compatibility.

Summary

In this guide, we covered:

  • How to mount Windows shares on RHEL 9 using CIFS
  • How to mount Windows shares on RHEL 9 using NFS
  • A detailed comparison between CIFS and NFS

Both protocols are powerful and have their place. With the right configuration and security practices, your RHEL 9 system can integrate seamlessly with Windows file servers.