====== Mount And Unmount Cifs And Nfs Network File Systems ======
**General Information**
Working with network shared file systems.
----
===== Example Data =====
The examples below assume the following server/share information:
* File server IP: 192.168.1.100
* Samba Username: rjones
* Samba Password: 123456
* Samba Share Name: public-docs
* NFS Share Name: public-storage
----
===== CIFS =====
Mounting a Common Internet File System (CIFS) share.
**Ensure packages are installed**
yum install -y cifs-utils samba-client
* samba-client optional for viewing shares.
\\
**Create target mount point, list shares**
mkdir /mnt/cifs-share
smbclient -L 192.168.1.100
\\
**Temporarily Mount Share**
mount -t cifs -o username=rjones //192.168.1.100/public-docs /mnt/cifs-share
\\
**Persistent Mount Share: Edit /etc/fstab, Add Entry/Save**
vim /etc/fstab
//192.168.1.100/public-docs /mnt/cifs-share cifs username=rjones,password=123456 0 0
\\
**More Secure Alternative: CIFS with credentials file**
vim /etc/fstab
//192.168.1.100/public-docs /mnt/cifs-share cifs credentials=/root/.cifs_mount 0 0
* /root/.cifs_mount file contentsusername=rjones
password=123456
* File should be chmod 600 and owned by root due to security concerns of a username/password being in a text file.
\\
**Mount all and Verify**
mount -a
df -hT
----
===== NFS =====
Mounting a Network File System (NFS) share.
**Ensure packages are installed**
yum install nfs-utils
\\
**Create target mount point**
mkdir /mnt/nfs-share
\\
**Temporarily Mount Share**
mount -t nfs 192.168.1.100:/public-storage /mnt/nfs-share
\\
**Persistent Mount Share: Edit /etc/fstab, Add Entry/Save**
vim /etc/fstab
192.168.1.100:/public-storage /mnt/nfs-share nfs defaults 0 0
\\
**Mount all and Verify**
mount -a
df -hT
----