Mount Windows Folder Sharing on RHEL 6/CentOS 6

Scenario:
-Mount Windows Folder Sharing (CIFS) on RHEL 6/CentOS 6.
-Set only Linux user >> user1 that have RWX access.
-Hide sharing credentials from other Linux users.
-Mount permanent at boot.

System: CentOS 6

Steps:
1) Edit /etc/fstab
# vi /etc/fstab

2) Type mount command in fstab.
Note: By default windows share mounted with the full permission (777) in Linux. To change the default permission use the dir_mode and file_mode options to set directory and file permission.

in this scenario,only Linux user user1 have read write access on /winshare.

3) Create folder sharing credential file.
# touch /root/.winpasw

4) Run mount command to /winshare
# mount -a

Test Result:

How to temporary mount Windows File sharing and moount to a directory
# mkdir /WinFolder
# mount -t cifs -o username=myusername,password=mypassword,domain=my.domain.com //192.168.2.5/folder /WinFolder

How to umount and delete directory
# umount /WinFolder
# rm -rf /WinFolder


Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *