Permissions ad owner changed with "ignore permissions" set

Dear friends, I’m running SyncTrayzor on a windows laptop, Syncthing in a OpenWRT x86 router and Syncthing deployed in a docker container over Unraid NAS server. Everything works as expected and files keep in sync. BUT every time a file get synced, it changes its ownership and permissions to “Syncthing” user, even if I checked the check box “ignore permissions” for every folder involved, in all machines. This is a problem because I access my files also through samba shares, and I’m unable to modify them (permission denied). So every time I need to change a synced file I need to change back permissions to everyone, before editing. How can I avoid this behaviour? Did I set something wrong?

Thank you for your help and patience and sorry for my poor English.

Not syncing permissions means permissions on newly created files will be whatever the OS thinks is the default (via umask etc on Unixes). Ownership for created files will always be that of the process owner, regardless of this setting. If you want files created by Syncthing to be owned by a certain user, then you need to run Syncthing as that user.

Thank you, so if I’d like to have full permissions for everyone, what I have to do?

If I set full permissions and untick the “ignore permissions” in all Syncthing involved, is the right way to do? I guess owner will be changed to “Syncthing” user after syncing, but I could access and modify files if permissions are maintained, right? What about Windows machine? Thank you again

I don’t know; OpenWRT, Docker, Unraid NAS, Samba, Windows, and how you specifically run Syncthing all affect this in different ways. You will have to experiment.

Hello, I made some tests, with just 2 nodes, the other was off. Node 1: Windows 7 laptop, SyncTrayzor 1.1.29, Syncthing version 1.20.1, test folder in HDD NTFS drive

Node 2: OpenWRT x86 router, Syncthing installed as additional packet v1.18.2, Linux (64-bit Intel/AMD), test folder in external HDD ext4

Starting condition: all files in test folder in Node 2 have been set to owner Nobody, permissions 0777, both nodes set to “ignore permissions”.

I edited a file via Samba share (same test folder) on node 2 (OpenWRT) (the file maintain the same owner and same permissions) → the file get synced correctly updating the node 1 (windows 7). Then I changed the same file on the node 1 (windows 7). The file is synced correctly updating node 2 (OpenWRT), BUT the file change owner to “Syncthing” (owner of the running process of Syncthing) and permissions to 0644.

If I play with “ignore permissions”, for both or just one node, whatever I do, the result is the same: at the end I have the modified file in Node 2 owned by “Syncthing”, permissions to 0644. The result is that I cannot modify the file from Samba share any more.

From this test the “ignore permissions” flag doesn’t seem to help to achieve my purpose: all permissions for all in the Node 2 folder. Any suggestion? Thank you

Google “umask” and how to change it before starting Syncthing on OpenWRT. You will want an umask of zero (no permissions are masked). “Ignore permissions” only means Syncthing doesn’t set them, there’s still a default from the operating system.

After some study and test, I haven’t been able to change default umask for Syncthing daemon in OpenWRT: I should change the /etc/init.d/syncthing file, because setting the umask in the /etc/config/syncthing configuration file doesn’t seems to work. But if I change the init.d file I’ll lose the modification in case of Syncthing packet upgrade. So I decided to change permissions with cron job, leaving enabled the “ignore permissions” option:

#set permissions every 10 minutes for Syncthing synced files
*/10 * * * * find /mnt/sda1 -type f -user syncthing ! -path '*/syncthing/*' -exec chmod 777 {} \;

I know it is horrible, but I run out of ideas and I’m a noob in Linux world. If you have a better idea, please let me know. Thank you.

1 Like

After some other study and test, I managed to solve the problem. The solution is to use the UMASK as calmh sugested. But I wasn’t able to do it using Syncthing addon in OpenWRT, because I should modify the /etc/init.d/syncthing file. This is not a good thing to do: the file would be changed every time I’ll upgrade Syncthing package. So I decided to follow the same path I used in Unraid enviroment: I uninstalled Syncthing package from OpenWRT and used instead the linuxserver/syncthing docker image. With this docker it is possible to modify the UMASK in the Docker run command. I set UMASK=0, configured Syncthing to ignore permissions in every node and everything works as expected. Thank you for your help. Syncthing is awesome.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.