How to, automatically, and with each restart, mount a WIN share on CentOS 6, using Samba.
Necessary starting conditions are :
# yum install samba-client samba-common cifs-utils
Set up smb and nmb processes to start automatically on startup (additional configuration is not necessary).
Make a mount point :
# mkdir /media/windowsshare
Now you are ready!
In /etc/fstab add a line (at the end of the file) :
//windowsshare/my-subfolder /media/windowsshare cifs user,uid=500,rw,suid,username=velda,password=my-pass,iocharset=utf8,sec=ntlm 0 0
# mount -a
And that is that.
What is what in /etc/fstab line :
General content of /etc/fstab file :
dir – The mountpoint where
type – The file system type of the partition or storage device to be mounted. Many different file systems are supported: cifs, ext2, ext3, ext4, btrfs, reiserfs, xfs, jfs, smbfs, iso9660, vfat, ntfs, swap and auto. The auto type lets the mount command guess what type of file system is used.
options – Mount options of the filesystem to be used.
dump – Used by the dump utility to decide when to make a backup. Possible entries are 0 and 1. If 0, dump will ignore the file system; if 1, dump will make a backup. Most users will not have dump installed, so they should put 0 for the dump entry.
pass – Used by fsck to decide which order filesystems are to be checked. Possible entries are 0, 1 and 2. The root file system should have the highest priority 1, all other file systems you want to have checked should have a 2. File systems with a value 0 will not be checked by the fsck utility.
user,uid=500,rw – gives RW rights on windowsshare to user velda, whose uid=500 (info concerning uid is not necessary, but it is better added, than not….)
cifs – protocol used (Samba has a version 2.2.4 integrated)
All these options may be seen using this command :
# man mount.cifs