I’ve installed Synthing on to my Unraid homelab to sync my family mobile phone photos and videos and then organize and manage them from my Windows machine. The problem is the folder acces. On first sync with my phone, for example, Syncthing creates the folder (“JaviPhone” in /mnt/user/sync/) with owners being “nobody:users”.
The problem is that the user is different in the “network drive” I’ve created in Windows. The user to access the shared folders in Unraid is “javi”, so I’d like Syncthing to create new folders with “javi:users” instead of “nobody:users”.
If I do a “chown -R javi:users /mnt/user/sync/JaviPhone” I can access that folder from Windows and that part is fine, but then I break Syncthing, and the folder shows up as disconnected. Changing again the user makes the situation back to the original, but that’s not an ideal solution.
I wonder if there’s a solution for this: the rest of the Windows network drive works well with that user:group, so I’d like to keep it that way and be able to configure syncthing to use those owners.
On Unix/Linux systems, generally speaking only a user with root privileges can assign ownership of a file/directory to another user, so it’s outside of Syncthing’s control.
Assuming that making everything in the network share world readable/writable isn’t desirable…
- Run separate Syncthing instances for each user. (Cleanest and simplest solution.)
- Make the directories and files group writable and have Syncthing part of the
users group. (It doesn’t solve the requirement that new files/directories be specifically owned by specific users, but it does solve the multi-user access requirement.)
- Depending on the filesystem for the storage volumes on the Unraid server, use access control lists (e.g. setfacl) to grant Syncthing read/write access to users’ files. (Doesn’t solve the specific user ownership requirement.)
- Since Windows is most likely accessing the network shares via SMB (with Samba on the Unraid server) – spoof the ownership. Combine
force user and
force group parameters in Samba so that Syncthing owns all of the target files and directories. From a Windows user’s perspective, they “own” their files and folders along with authenticating to access network shares, but behind-the-scenes, Syncthing owns everything. (No need to manage multiple Syncthing instances.)
You didn’t mention how Syncthing is being run which could affect the suggestions above.
Thanks, I’ll try the last one first and see what hapens. Syncthing is being run on a Docker container in Unraid, and the mobile phone is an Android one with the Syncthing app installed and running. I don’t know if you need more details.
As for the first solution, I don’t know if I can run instances in my case as you mention (the way it’s running could affect that suggestion), but the Windows and SMB idea could be the way to solve this.
It’s more complicated to set up compared to tweaking Samba, but it’s not difficult to run multiple Syncthing instances inside a Docker container. Additional users just need to be created in the container matching the users outside of the container.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.