Simple CIFS fstab entry

# cat /etc/fstab | grep SHARE
//FILESERVER/SHARE$       /mnt/SHARE     cifs   username=domain\user,password=mypassword 0 0

# mount /mnt/SHARE
# ls -ld /mnt/SHARE/
drwxrwxrwx 1 root root 4096 2014-07-01 08:34 /mnt/SHARE/

Avoid saving plain text password in /etc/fstab

# cat /etc/fstab | grep SHARE
//FILESERVER/SHARE$       /mnt/SHARE     cifs    credentials=/root/.smbcredentials 0 0

# cat /root/.smbcredentials
username=domain\user
password=mypassword

Dont forget .smbcredentials permissions

# chmod 600 /root/.smbcredentials

Setting owner and group

# cat /etc/passwd
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
...
nagiosadmin:x:1000:1000:nagiosadmin,,,:/home/nagiosadmin:/bin/bash
mysql:x:104:106:MySQL Server,,,:/var/lib/mysql:/bin/false
nagios:x:105:107::/var/run/nagios3:/bin/sh
...

# cat /etc/fstab | grep SHARE
//FILESERVER/SHARE$ /mnt/SHARE cifs uid=105,gid=107,credentials=/root/.smbcredentials 0 0
# ls -ld /mnt/SHARE/
drwxrwxrwx 1 nagios nagios 4096 2014-07-01 08:34 /mnt/SHARE/

Setting permissions masks

# cat /etc/fstab | grep SHARE
//FILESERVER/SHARE$ /mnt/SHARE cifs uid=105,gid=107,dir_mode=0770,file_mode=0770,credentials=/root/.smbcredentials 0 0

# ls -ld /mnt/SHARE/
drwxrwx--- 1 nagios nagios 4096 2014-07-01 08:34 /mnt/SHARE/

dmask and fmask cannot be used for CIFS

# cat /etc/fstab | grep SHARE //FILESERVER/SHARE$ /mnt/SHARE cifs uid=105,gid=107,dmask=0770,fmask=0770,credentials=/root/.smbcredentials 0 0

# mount /mnt/SHARE
WARNING: CIFS mount option 'dmask' is deprecated. Use 'dir_mode' instead.
WARNING: 'dir_mode' not expressed in octal.
mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

Enable different SMB version

PS C:> Get-SmbSession | select Dialect
Dialect
-------
1.01
# cat /etc/fstab | grep SHARE
//FILESERVER/SHARE$ /mnt/SHARE cifs uid=105,gid=107,dir_mode=0770,file_mode=0770,credentials=/root/.smbcredentials,vers=3.02 0 0

PS C:> Get-SmbSession | select Dialect
Dialect
-------
3.02