Win to Linux changes permissions

I sync files between Linux and Windows for development. This is particularly annoying for executable files. If it is rwx in Linux, when I change that file on my Windows machine and it gets synced over, the execute bit is gone.

The “ignore permissions” settings doesn’t do anything, and from my understanding, Syncthing isn’t supposed to change permissions anyway.

Is this a bug? Or am I missing a config setting?

It uses umask if ignore permissions is set. You also might want to ignore permissions on both sides.

Files synced from windows will lose the executable bit unless the file is an executable on Windows, i.e., an exe file or similar.

With “ignore permissions” set Syncthing will never set the executable bit, you’ll get files with 0666 minus the umask.

I’m trying to make file changes on a package that includes both .sh (executable) and .java (non executable) files.

Is there no way to preserve whatever permissions Linux has set for them?

I don’t think so, unfortunately. When the file is changed Windows-side Syncthing will pick up it’s new data (contents) and metadata (modification time, permission bits). On Windows it will look like a regular text file so there is no reason to assume the execute bit should be set; Syncthing will synthesize 0644 or something similar.

What you can do is add .sh to the PATHEXT environment variable. This will make Windows consider .sh files executable and Syncthing, on seeing the extension in PATHEXT will send the execute bit for it.

There may be downsides to doing that. Double clicking an .sh file will attempt to run it, which may both not work and have security aspects…

Also, it sounds like you might rather be using something like Git or Subversion to check in and sync your changes.

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