Walker News

How To Mount Network Shared Folder In RHEL6?

Not enough free disk space for performing temporarily database backup? No worry, let’s mount a Samba or Windows shared folder to Linux, if network speed is not an issue.

On RHEL5.x, we only need to install samba client package that provides the mount.cifs utility. On RHEL6.x, however, the mount.cifs comes with cifs-utils package and is not included by samba-client package.
So, before you can mount the network shared folder in Linux, you must have installed samba-client (for RHEL/CentOS 5.x) or cifs-utils (for RHEL/CentOS 6.x).

This is what I get in RHEL 6.3 that has no mount.cifs utility:

mount: block device //smb01/dump$ is write-protected, mounting read-only
mount: cannot mount block device //smb01/dump$ read-only

Mount a Windows shared folder provided by user “gstusr” of “mydom” domain to /mnt directory:
Take note of the “/” character used in Linux as compare to “\” character used in Windows.
mount -t cifs -o user=mydom/gstusr //win01/d$ /mnt

To simplify the mount syntax, as well as to auto mount the shared folder upon Linux boots up, you can add an entry in /etc/fstab configuration file:
//win01/d$  /mnt cifs credentials=/.smbp,defaults  0 0

Then, create the /.smbp credential file that contains user ID and password for accessing the network shared folder:

Change the /.smbp file permission to read-only by root user ID (for security’s sake):
chmod 400 /.smbp

Now, you should be able to mount //win01/d$ to /mnt with this simplified syntax:
mount /mnt

Custom Search

2016  •  Privacy Policy