On RHEL4 creating a new file on a CIFS mount ignores the fmask/file_mode and uses the system umask instead.

Solution Verified - Updated -

Issue

  • Creating a new file on a CIFS mount ignores the fmask or file_mode and uses the system umask instead.
  • Remounting the CIFS mount will resolve any permissions problems encountered.
  • smbfs mounts with the correct permissions:
root@hostname:~# cat /etc/fstab | grep smbfs
//192.168.1.23/TEST /mnt smbfs gid=users,fmask=0660,dmask=0770,username=xxxx,password=xxxx 0 0

root@hostname:~# mount /mnt ; cd /mnt/test

root@hostname:/mnt/test# touch test_smbfs ; ls -l test_smbfs
-rw-rw---- 1 root users 0 2012-07-05 18:45 test_smbfs
  • An example of the same process completed with CIFS can be found below, note how the file_mode is not correctly applied:
root@hostname:/# cat /etc/fstab | grep cifs
//192.168.1.23/TEST /mnt cifs gid=users,file_mode=0660,dir_mod=0770,username=xxxx,password=xxxx 0 0

root@hostname:/# mount /mnt ; cd /mnt/test

root@hostname:/mnt/test# touch test_cifs ; ls -l test_cifs
-rw-r--r-- 1 root users 0 2012-07-05 18:47 test_cifs
  • However, a remount via CIFS will fix the permission problems:
root@hostname:/mnt/test# cd / ; umount /mnt
root@hostname:/# mount /mnt ; cd /mnt/test

root@hostname:/mnt/test# ls -l test_cifs
-rw-rw---- 1 root users 0 2012-07-05 18:47 test_cifs

Environment

  • Red Hat Enterprise Linux 4
  • kernel < 2.6.9-100

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.