I was working on a system recently migrated from a very old Solaris server to Oracle Linux 6.6. It mounts a CIFS (SMB) share from a Windows Server 2012 R2 host, just like the old system did, but non-root users could no longer write to it or create files.
The Symptom
The empty mount point has 777 permissions:
[root@localhost ~]# ls -ld /datastore/
drwxrwxrwx 2 root root 4096 Jan 6 09:50 /datastore/
But once the share is mounted, they drop to 755:
[root@localhost ~]# ls -ld /datastore/
drwxr-xr-x 1 root root 634564 Jan 6 09:50 /datastore/
On the old server, files and subdirectories on the share had the setuid bit, which the new system doesn’t. The original /etc/fstab entry was:
//cifshost/datastore /datastore cifs username=user,password=password,domain=mydomain.local 0 0
The Fix: Add file_mode and dir_mode
Edit /etc/fstab and add the file_mode=0666,dir_mode=0777 mount options:
//cifshost/share/datastore /datastore cifs user=user,pass=password,file_mode=0666,dir_mode=0777 0 0
Remount the share, and non-root users can read and write again.
