Wrong file permissions in Windows/WSL

Hi all, I have been using Syncthing without any issues for the past couple of years in Linux.

I now tried to setup a windows machine and I am having a problem with file permissions.

For some reason Syncthing sets all file permissions in windows with the “executable” bit. This means that inside Windows Subsystem for Linux, they show up as “755”.

Is this a bug or is there any setting I am missing here?

That shouldn’t happen, we use 666 (potentially restricted by system umask) unless the file info from the remote device reports anything else. Are you sure this is specific to Syncthing and not just what windows does (everything is 755).

When I create a file in Windows (from WSL) it gets created correctly with the right permissions.

If I change a file permissions in WSL, the permissions don’t get synced with the other clients (which is fine).

But, if I change the file permissions in WSL to 644 (for instance) and then alter that same file in a linux client with a new line (but keeping the same permissions), then in WSL the permissions revert to 755 after synchronizing.

Are you running Syncthing under Windows or WSL? Do you have ignore permissions selected (folder settings)? What is the permission of a file created on Windows (not WSL)?

I am running from under Windows.

I don’t have ignore permissions selected (I thought that was only for fat32 systems).

A file created in windows will inherit the permissions from my wsl.conf, so in this case it is a 755.

P.S. I am actually about to give up and just run Syncthing from inside WSL and be done with it. I think everything will work fine this way anyway, or am I missing something?

I have no clue what happens with permissions on windows. On our side we tell the golang standard library to chmod to whatever permission was set on the linux side. As there’s probably no direct windows equivalent for that (otherwise you probably wouldn’t need to configure fallback perms for WSL), they are probably “converted” to include execute perms along the way.

If you care about linux perms in WSL (aka work in there), I’d guess that’s a good idea. It’s possible that there’s limitations in WSL that affects Syncthing (e.g. filesystem watching), but I wouldn’t know.

Ok, I will try that and make an update here if it works fine, for future reference.

Thank you for all the help.

2 Likes

So, I installed it inside a Ubuntu WSL and so far it seems to run ok (I didn’t try to actually sync anything).

There is a warning that shows up though: WARNING: Failed to lower process priority: set niceness: permission denied

Not sure if this is an important WARNING or if I can just ignore it.

Last fix I can think up, is to run syncthing from inside a docker container in windows.

You can ignore that. There is a config option to not attempt to lower the priority, which would get rid of the warning too.

1 Like

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