Can't force permissions to allow file writes
The following represents the "samba" portion of my docker-compose.yaml file. The problem is that even though I have manually set file permissions for all my files to 0666, and all directories to 0777; and even though I have used the samba configuration in my docker-compose.yaml file to force all files to 0666 and all directories to 0777, after some period of time the files revert to 0664 and the directories revert to 0775, which I believe are the "default" values in /etc/samba/smb.conf.
samba:
container_name: samba
restart: unless-stopped
image: dperson/samba
command: '-n -s "office-share;/mount/office-share;yes;no;yes" -g "force user = www-data" -g "force group = www-data" -g "create mask = 0666" -g "directory mask = 0777" -g "force create mode = 0666" -g "force directory mode = 0777" -p'
mem_limit: '512m'
networks:
default:
ipv4_address: '172.16.0.110'
ports:
- 137:137/udp
- 138:138/udp
- 139:139/tcp
- 445:445/tcp
tmpfs:
- /tmp
stdin_open: true
tty: true
environment:
- TZ=PST8PDT
# USERID = 33 == www-data
# GROUPID = 33 == www-data
- USERID=33
- GROUPID=33
- WORKGROUP=WORKGROUP
volumes:
- /media/share-drive:/mount
The relevant portion of /etc/samba/smb.conf looks like this:
pam password change = yes map to guest = bad user usershare allow guests = yes create mask = 0666 force create mode = 0666 directory mask = 0777 force directory mode = 0777 force user = www-data force group = www-data follow symlinks = yes load printers = no printing = bsd printcap name = /dev/null disable spoolss = yes strict locking = no aio read size = 0 aio write size = 0 vfs objects = catia fruit recycle streams_xattr recycle:keeptree = yes recycle:maxsize = 0 recycle:repository = .deleted recycle:versions = yes
Security
client ipc max protocol = SMB3 client ipc min protocol = SMB2_10 client max protocol = SMB3 client min protocol = SMB2_10 server max protocol = SMB3 server min protocol = SMB2_10
Time Machine
fruit:delete_empty_adfiles = yes fruit:time machine = yes fruit:veto_appledouble = no fruit:wipe_intentionally_left_blank_rfork = yes
[office-share] path = /mount/office-share browsable = yes read only = no guest ok = yes veto files = /.apdisk/.DS_Store/.TemporaryItems/.Trashes/desktop.ini/ehthumbs.db/Network Trash Folder/Temporary Items/Thumbs.db/ delete veto files = yes
Throughout the day, I've made many minor changes, trying to find the "perfect" configuration. Sometimes Windows 10 can read the files in the share, sometimes it completely fails. The problem that I'm trying to solve at the moment is that although I can read files using Windows 10 file explorer, if I change a file, I cannot save it back into that same folder. Attempts to save the file fail. This is really, really confusing. I've spent about 14 hours on this today. What am I missing?
For further clarification, I set my USERID to 33 ("www-data") and my GROUPID to 33 ("www-data") in the Samba configuration, and I manually changed ownership and group affiliation to all files in my mounted directory using:
sudo chown -R www-data.www-data *
in order to make the files accessible to my Nextcloud server as an "External storage" device as well.
Similar problem i faced on mac. I've shared folder to host and not able to override files using java smb client, but able to override those files manually on shared folder.