I tested this on a clean install of Debian Jessie, but I also have this problem on other machines (ex: Ubuntu 12.04). In addition to the base install, I installed sudo
, samba
, and cifs-utils
.
Shared Directory With Default ACL
I enabled ACLs on the root file system and created a shared directory:
sudo mount -o remount,acl /
mkdir -p /home/ryan/shared
setfacl -d -m u:ryan:rwx /home/ryan/shared
Samba Config
I left all defaults in /etc/samba/smb.conf
and added a single share:
[shared]
comment =
path = /home/ryan/shared
writable = yes
valid users = ryan
Add Samba User
Then I added myself as a Samba user and restarted the service:
sudo smbpasswd -a ryan
sudo systemctl restart smbd
Linux Client
Next I created a mount point for the Samba share, mounted it, and created an empty text file:
mkdir -p /home/ryan/mnt/shared
sudo mount -t cifs -o user=ryan //127.0.0.1/shared /home/ryan/mnt/shared
touch /home/ryan/mnt/shared/linux.txt
Windows Client
I also connected from a Windows 8 machine and created an empty text file named windows.txt
.
Shared Directory Listing
After that, a directory listing of /home/ryan/shared
looks like this:
-rw-r--r--+ 1 ryan ryan 0 Jun 20 23:45 linux.txt
-rwxrwxr--+ 1 ryan ryan 0 Jun 20 23:46 windows.txt
File ACLs
The ACL for linux.txt
looks like this:
# file: linux.txt
# owner: ryan
# group: ryan
user::rw-
user:ryan:rwx #effective:r--
group::r-x #effective:r--
mask::r--
other::r--
The ACL for windows.txt
looks like this:
# file: windows.txt
# owner: ryan
# group: ryan
user::rwx
user:ryan:rwx
group::r-x
mask::rwx
other::r--
Questions
The behavior from the Linux client is what I would expect. Why is it different when using a Windows client? How can I get the Windows client to set the same permissions as the Linux client?
Best Answer
You can have Samba normalize everything the clients send it, see
man smb.conf
for things like: