This article shows how to configure a Redhat/CentOS 7 workstation to access a remote storage system using both NFS and CIFS. This article focuses on the workstation (client) side. The server should already be configured to share the resources.
For this demonstration, the following detalis need to be know about the server.
server IP address = 10.0.0.1 # CIFS shared = //server/shares username = redhat password = redhat domain = REDHAT # NFS exported = (user home directories)
Install the following:
yum install cifs-utils autofs
Stage 1. User home directories via NFS:
The first stage of this demonstration relates to users auto-mounting their home directory via NFS on login. Make sure the user ID (uid) is the same on the server as on the workstation. If not, this will not work.
Create the file “/etc/auto.master.d/home.autofs”:
/home /etc/autofs.home
Create the file “/etc/autofs.home”:
* -rw server:/home/&
Start and enable the autofs daemon.
systemctl enable autofs systemctl restart autofs
Now test it. Login as a user who’s UID is the same on the local system as on the remote NFS system. Create a file in the users home directory and see if they also exist on the remote system. If so, it’s working.
Stage 2. Accessing shares via CIFS/SMB:
The second stage of this demonstration relates to users auto-mounting a shared directory via CIFS.
Make the following directory on the workstation:
mkdir /shares
Create the file “/etc/users.master.d/shares.autofs”:
/shares /etc/auto.shares
Create the file “/etc/auto.shares”:
work -fstype=cifs,credentials=/etc/me.cred ://server/shares/&
Create the “/etc/me.cred” file:
username=redhat password=redhat domain=REDHAT
Restart the autofs daemon.
systemctl restart autofs
Now test it. As any user, run the command “ls /shares/work” and see if you can see files that exits on the server in that location. If so, it’s working.