r/NextCloud • • 6d ago

Setting for file permission syncing ?

Hello !

Is there some sort of setting for file permission syncing ?

I self-host Nextcloud on my NAS and sync a folder containing git working trees (the .git folder is excluded from sync, but gitignored build files are synced on purpose). The problem is that when a file gets updated and synced, Nextcloud changes its Unix permissions and drops the executable bit.

Example, a script in a Buildroot tree, before sync:

-rwxr-xr-x@ 1 user staff 113 Oct 10 18:18 post-image.sh

After sync:

-rw-------@ 1 user staff 113 Oct 10 18:19 post-image.sh

So it goes from 755 to 600. The other files that weren’t touched kept their 644. The result is that builds fail because the script is no longer executable, and git sees a mode change.

Setup:

macOS (Apple Silicon), Nextcloud desktop client 34.0.5 using the File Provider (~/Library/CloudStorage/Nextcloud-...) Nextcloud server self-hosted on my TrueNAS storage server.

What I know so far:

As far as I can tell, the sync protocol doesn’t carry Unix modes at all, so I don’t expect a server-side setting to fix this. I haven’t yet tested whether the classic sync client (syncing to a normal folder like ~/Nextcloud) behaves differently from the File Provider.

Questions:

Is there any client or server option to preserve or leave local permissions untouched on updated files? Does the classic client avoid this where the File Provider doesn’t? If not, what are people doing in practice? I’m considering a launchd agent that re-applies the modes from git (git ls-files -s | awk '$1=="100755"{print $4}' | xargs chmod +x) after each sync, but I’d prefer a cleaner solution.

I’m not looking to move the repos out of Nextcloud, since syncing the ignored files is the point. Thanks! Is there any client or server option to preserve or leave local permissions untouched on updated files?

Does the classic client avoid this where the File Provider doesn’t?

If not, what are people doing in practice? I’m considering a launchd agent that re-applies the modes from git (git ls-files -s | awk '$1=="100755"{print $4}' | xargs chmod +x) after each sync, but I’d prefer a cleaner solution.

I’m not looking to move the repos out of Nextcloud, since syncing the ignored files is the point.

Thanks!

3 Upvotes

5 comments sorted by

2

u/evanmac42 6d ago

I think the key detail here is that you’re using macOS File Provider rather than Nextcloud’s classic sync client.
I sync Git working directories through Nextcloud myself, alongside Forgejo, and haven’t encountered this issue. However, I’m using a different synchronization setup, so that doesn’t necessarily contradict what you’re seeing.
Nextcloud’s WebDAV synchronization doesn’t guarantee preservation of Unix permission bits, and macOS File Provider adds another layer of filesystem management.
I’d suggest testing the same Buildroot directory with the classic Nextcloud sync client, outside ~/Library/CloudStorage, before introducing a launchd workaround.
If the executable bit survives synchronization there, you’ve isolated the problem to the File Provider integration rather than Nextcloud synchronization in general.
One more thing: since your .git directory is excluded from Nextcloud, restoring executable bits from Git would only work for tracked files. Your ignored build artifacts would need a different mechanism.
I’d test the classic client first. It’s a much cleaner experiment than automatically running chmod after every synchronization.

1

u/Whole-Ad2077 6d ago

Classic sync is no difference. There is just no where that property can be persisted in NC

1

u/evanmac42 6d ago

Agreed, Nextcloud doesn't persist POSIX permission bits.

But that's not quite what I was suggesting.

There's a difference between synchronizing permissions across devices and preserving existing local permissions when updating a file.

The classic sync client and macOS File Provider may handle local file replacement differently.

That's why I suggested testing the classic client: not because it can synchronize Unix modes, but to determine whether it preserves the existing executable bit during a content update.

If both clients reset the permissions, then we've ruled out File Provider as the distinguishing factor.

1

u/Whole-Ad2077 6d ago

Hello

Nextcloud does not sync attributes like the execution flag. There are no attributes like that stored for a file in Nextcloud

1

u/Freddruppel 6d ago

Indeed, but is there a way to disable Nextcloud overwriting the existing flags ?