How to Mount a Windows Shared Folder in Linux CentOS 6.3

In this post, I will share on how to mount windows share folder on linux CentOS 6.3 server. Assumed that windows share folder has been configured properly with administrator privileged. This uses Common Internet File System (CIFS) protocol. CIFS can lets you access to shared folder and files that are remotely on the server and can do read and write to them.

Windows Share: //192.168.2.51/Files
Windows Credentials : username=administrator,password=mypassword

1. Execute the following command to mount Windows share folder :

[root@centos63 /]# mount -t cifs -o username=administrator,password=mypassword //192.168.2.51/Files /mnt

2. Verify that Windows share folder already mounted to /mnt :

[root@centos63 /]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_centos63-lv_root
                       5716804   2451228   2975172  46% /
tmpfs                   515400         0    515400   0% /dev/shm
/dev/sda1               495844     66280    403964  15% /boot
//192.168.2.51/Files 476403708 343375460 133028248  73% /mnt

3. Add that Windows share folder into /etc/fstab file, so that it will auto mount once rebooted :

[root@centos63 ~]# vi /etc/fstab

Add the final line as below :

#
# /etc/fstab
# Created by anaconda on Sun Jul 15 20:17:38 2012
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_centos63-lv_root /                       ext4    defaults        1 1
UUID=2217c7b1-4467-4c81-8596-c3ee7758e2cc /boot                   ext4    defaults        1 2
/dev/mapper/vg_centos63-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
//192.168.2.51/Files    /mnt                    cifs    username=administrator,password=mypassword 0 0