Configuring a Base NFS Server

Create a directory intended for sharing:

mkdir /data

Create the /etc/exports containing a path to the directory and the following line:

/data   *(rw,no_root_squash)

Open the nfs, mountd, and RPC-bind services in firewalld:

firewall-cmd --add-service nfs
firewall-cmd --add-service nfs --permanent
firewall-cmd --add-service mountd
firewall-cmd --add-service mountd --permanent
firewall-cmd --add-service rpc-bind
firewall-cmd --add-service rpc-bind --permanent

Run the nfs-server service:

systemctl enable --now nfs-server

Mounting NFS Shares

Use showmount -e [nfs-server] to show exports:

showmount -e
Export list for
/data *

Use mount nfsserver:/[share_dir] /[mnt_dir] to mount the share:

mount /mnt

To mount persistently, append the _netdev mount option to the share’s mount entry in /etc/fstab:

vim /etc/fstab /nfs nfs _netdev 0 0

Configuring a Base Samba Server

Install the Samba server package:

yum install samba

Create the directory intended to be shared:

mkdir /samba

Create a local Linux user:

useradd samba

Set Linux permissions:

chown samba /samba
chmod 770 /samba

Use smbpasswd -a to add a Samba user account:

smbpasswd -a samba

Enable the share in /etc/samba.smb.conf:

vim /etc/samba/smb.conf



comment = samba share path = /samba write list = samba

Start the samba service:

systemctl enable --now smb

Add the samba service to firewalld:

firewall-cmd --add-service samba
firewall-cmd --add-service samba --permanent

Mounting Samba Shares

Install the cifs-utils and samba-client RPM packages:

yum groups install "Network File System Client"

Use smbclient -L //[share] to discover shares:

smbclient -L //

If asked for root password, just press ENTER

Mount the share using mount -o username=[user] //[server_ip_addr]/[share] /[mnt_point]:

mount -o username=samba //

To mount the share persistently, include the cifs and netdev, username=[user], password=[passwd] mount options in /etc/fstab:

vim /etc/fstab

// samba cifs _netdev,username=samba,password=password

Understanding Automount

A directory that automount should mange is defined in /etc/auto.master. The file identified is used for additional information:

/data   /etc/

In /etc/, the subdirectory intended to mounted and what exactly is going to be mounted is identified:

files   -rw nfsserver:/data/files

Ensure the autofs service is started:

systemctl enable --now autofs

Configuring Automount

Install the autofs package:

yum install autofs

Start and enable the autofs service:

systemctl enable --now autofs

/etc/auto.misc contains examples of mount mapping through autofs

Create an entry in auto.master:

vim /etc/auto.master

/files   /etc/auto.files

Then create the file specified:

vim /etc/auto.files
data   -rw

Restart the autofs service:

systemctl restart autofs

Ensure the directory was created:

ls / | grep files

Configuring Automount for Home Directories

First, on the NFS host, edit /etc/exports to include the /home directory:

vim /etc/exports

/home/ldap   *(rw)

Then restart the NFS server:

systemctl restart nfs-server

On the client’s end, edit the /etc/auto.master file:

/home/ldap   /etc/auto.ldap

Then include the following in /etc/auto.ldap:

*   -rw   [ip_addr]:/home/ldap/&

Restart the autofs service to apply the changes:

systemctl restart autofs

Leave a Reply

Your email address will not be published.