Force specific permissions for new synced files

I want to sync my Minecraft and Mindustry data between my Android phone and Linux machine. Because Android is stupid, access to Android/data is restricted, so I know only two ways: root or adb. That’s why I run Syncthing fork on Android as super user, but here comes a problem. When Syncthing syncs new files or folders, it doesn’t set permissions Mindustry needs to access the files, the directory and everything in it must be owned by user 10226 (aka Mindustry app). So the question is: how can I make Syncthing change owner of new synced files? It’s not necessary to be done in Syncthing itself, maybe there’s an app I can use or script I can make that will do that? I don’t think I can just sync permissions and owners, because then it would configure them incorrectly on my desktop Linux and Mindustry there won’t be able to read/write files. Maybe I don’t understand how permission/ownership syncing work and I should just turn them on?

Currently I have Termux widget instead of Mindustry shortcut that changes owner of Mindustry data directly and everything in it to Mindustry itself, but that’s… no the greatest solution.

My understanding of Android is zero; I’m coming at this from my limited Linux experience. I would probably write a shell script to identify the files in the directory that did not have the correct owner, and chown them to solve the issue.

Depending on the specifics of your use case, you could run that script at boot, manually, or using cron at an interval that makes sense to you. Brief googling makes me think that cron jobs are more difficult on Android than with Linux.

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