# FreeNAS Syncthing plugin permissions strangeness

**URL:** https://forum.syncthing.net/t/freenas-syncthing-plugin-permissions-strangeness/12622
**Category:** Support
**Created:** [January 1, 2019, 5:57pm UTC](https://forum.syncthing.net/t/freenas-syncthing-plugin-permissions-strangeness/12622 "2019-01-01T17:57:53Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![bozho](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/b/7c8e57/32.png) [@bozho](https://forum.syncthing.net/u/bozho)
#### Post date: [January 1, 2019, 5:57pm UTC](https://forum.syncthing.net/t/freenas-syncthing-plugin-permissions-strangeness/12622/1 "2019-01-01T17:57:53Z")

</div>

Hi all!

I have a strange Syncthing plugin problem on FreeNAS.

I’ve created a separate ZFS dataset (think of it as a drive partition) for syncthing. When creating a dataset, you can choose for it to use either Unix permissions or ACLs.

Since FreeNAS plugins run in FreeBSD jails, its users and groups are separate from base system’s users and groups. In addition to that, any storage external to a jail must be explicitly mounted.

There are several approaches in setting permissions to make mounted storage available to jail users. The one I use in this scenario is to have a group in the base system (e.g. `backup`, GID=1003) and set desired permissions on the directory in the base system. Then, create a group with the same GID in the Syncthing jail and add the syncthing jail user to that (jail) group. That way, base system’s group permissions effectively get propagated to the same group inside the jail.

Now, I have a Win10 laptop with syncthing running (already syncing a few directories to an RPi). I’ve tried sharing two directories with the FreeNAS Syncthing instance (one is my Documents directory, the other one the phone photos directory already synced with my Android phone)

Initially, I’ve only created the `sync` dataset on FreeNAS and let Syncthing create a top-level directory when creating each share (`documents` and `phone_photos`)

If the `sync` dataset is created with Unix permissions, everything works as expected.

However, if I create the `sync` dataset with ACLs (Windows permissions), the phone photos share gets synced properly, but the documents share fails with an error like `finisher: chmod /mnt/bozho/documents/My Games/Borderlands/WillowGame/Logs/.syncthing.Launch-backup-2017.03.13-21.56.32.log.tmp: operation not permitted` for every file. All subdirectories under `documents` get created.

`getfacl` on `documents` returns:

```
# file: documents/
# owner: syncthing
# group: backup
            owner@:rwxpDdaARWcCos:fd----I:allow
            group@:rwxpDdaARWcCos:fd----I:allow
         everyone@:r-x---a-R-c---:fd----I:allow

```

`phone_photos` (the one that gets synced properly) has the same permissions, as does the `Logs` directory with the `.tmp` file.

`getfacl` for the `.tmp` file returns:

```
# file: .syncthing.Launch-backup-2017.03.13-21.56.32.log.tmp
# owner: syncthing
# group: backup
            owner@:rwxpDdaARWcCos:------I:allow
            group@:rwxpDdaARWcCos:------I:allow
         everyone@:r-x---a-R-c---:------I:allow

```

Files in `phone_photos` have the same permissions.

Any ideas what might be happening here?

Thank you

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [January 1, 2019, 6:59pm UTC](https://forum.syncthing.net/t/freenas-syncthing-plugin-permissions-strangeness/12622/2 "2019-01-01T18:59:39Z")

</div>

> [@Permission Denied on any path I choose (FreeNAS)](https://forum.syncthing.net/t/permission-denied-on-any-path-i-choose-freenas/1729):
>
> If I try to create or use an existing directory on my FreeNAS (To replicate to another FreeNAS) I am met with permission denied. So if I try to replicate for example /mnt/volume1 , or create a new directory (/replicationtest) Syncthing just comes up with the same error each time. Help!

> [@Many Out of Sync items after inital sync](https://forum.syncthing.net/t/many-out-of-sync-items-after-inital-sync/7199):
>
> I have setup syncthing to backup files from my Windows 8.1 laptop in C:\Users (source) to a freenas 9.2 based syncthing (target). After setting up the C:\Users folder the initial syncs begins. The source folder is configured as a “Folder Master”. After the initial sync the target shows “Out of Sync” for all files. I checked the directories with freefilesync and found that in the target all files are replicated with a “.syncthing.” prefix. Enclosed find screenshots of the target syncthing

> [@Syncthing on FreeNAS: Files transfer completely but .syncthing prefix and .tmp suffix never get removed](https://forum.syncthing.net/t/syncthing-on-freenas-files-transfer-completely-but-syncthing-prefix-and-tmp-suffix-never-get-removed/11394):
>
> So I am trying to sync between my Mac and a FreeNAS. For those of you not familiar, FreeNAS is an open-source OS that turns any x86 box into a free-standing NAS with a web GUI, based on FreeBSD. Syncthing is available as a plugin for FreeNAS, and runs in a jail (for those familiar with that UNIX concept). The rub in my case is that the FreeNAS can connect to a Windows Domain Controller on the network and serve Samba shares and have their permissions managed by the domain controller. Unfortunate…

---

<div class="post-metadata">

### Author: ![bozho](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/b/7c8e57/32.png) [@bozho](https://forum.syncthing.net/u/bozho)
#### Post date: [January 1, 2019, 7:54pm UTC](https://forum.syncthing.net/t/freenas-syncthing-plugin-permissions-strangeness/12622/3 "2019-01-01T19:54:41Z")

</div>

Huh, while I did find the first and the third link, I missed the second one somehow, thank you!

The confusing thing is that sync works on the same dataset for my phone photos directory (those are receive-only on my laptop) and they are synced to FreeNAS only from my laptop as receive-only (haven’t added my phone to the FreeNAS Syncthing).

I just tested and ignoring permissions on the `documents` on the FreeNAS Syncthing made it work. The `phone_photos` directory on the FreeNAS Syncthing does not ignore permissions and is working fine. Is Syncthing not trying to `chmod` these files because their original source is an Android phone?

---

<div class="post-metadata">

### Author: ![bozho](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/b/7c8e57/32.png) [@bozho](https://forum.syncthing.net/u/bozho)
#### Post date: [January 2, 2019, 9:29am UTC](https://forum.syncthing.net/t/freenas-syncthing-plugin-permissions-strangeness/12622/4 "2019-01-02T09:29:53Z")

</div>

The only difference I found was that phone photos on my laptop inherited permissions from my home dir and files in the Documents directory had explicit permissions set.

I then made sure that my home dir and everything in it is owned by me and reset all the permissions on files and directories in the home dir to inherit from the home dir. Made sure that files in the Documents directory inherit permissions.

Then I removed both shares from the FreeNAS Syncthing, deleted both directories from the FreeNAS storage and re-added both shares (_not_ ignoring permissions on both). Phone photos share synced without problems, the documents share keeps reporting failing `chmod`.

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [January 2, 2019, 12:14pm UTC](https://forum.syncthing.net/t/freenas-syncthing-plugin-permissions-strangeness/12622/5 "2019-01-02T12:14:24Z")

</div>

Syncthing requires chmod to work, if it does not work on your platform, I can’t predict what the behaviour will look like.

---

<div class="post-metadata">

### Author: ![bozho](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/b/7c8e57/32.png) [@bozho](https://forum.syncthing.net/u/bozho)
#### Post date: [January 2, 2019, 12:34pm UTC](https://forum.syncthing.net/t/freenas-syncthing-plugin-permissions-strangeness/12622/6 "2019-01-02T12:34:19Z")

</div>

I understand that, but the confusing thing is that it does work for one shared folder, but not the other (on the same system) - that’s what I’d like to figure out.

Edit: Is there a scenario where Syncthing would not call `chmod`, which could explain the phone photos share working?

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [January 2, 2019, 12:46pm UTC](https://forum.syncthing.net/t/freenas-syncthing-plugin-permissions-strangeness/12622/7 "2019-01-02T12:46:30Z")

</div>

Not really, I think it calls chmod on all operations to make sure the directory its working in is writable.

Then does chmod based on wether permissions are ignored or not.

---

<div class="post-metadata">

### Author: ![wweich](https://forum.syncthing.net/user_avatar/forum.syncthing.net/wweich/32/1063_2.png) [@wweich](https://forum.syncthing.net/u/wweich)
#### Post date: [January 2, 2019, 8:50pm UTC](https://forum.syncthing.net/t/freenas-syncthing-plugin-permissions-strangeness/12622/8 "2019-01-02T20:50:53Z")

</div>

I think, the Android App still “enforces” ignore perms, so at least the remote (from the NAS side of view) has ignore perms, and so maybe does no `chmod` or does something different then if it wasn’t set.

---

<div class="post-metadata">

### Author: ![bozho](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/b/7c8e57/32.png) [@bozho](https://forum.syncthing.net/u/bozho)
#### Post date: [January 2, 2019, 9:18pm UTC](https://forum.syncthing.net/t/freenas-syncthing-plugin-permissions-strangeness/12622/9 "2019-01-02T21:18:21Z")

</div>

I’m not syncing directly with the phone, I’m only sharing from my Win10 laptop to FreeNAS. Could that setting be implicitly transferred, too?

---

<div class="post-metadata">

### Author: ![system](https://forum-uploads.syncthingcdn.net/original/2X/0/0b50e0a202b22ae6a67190759e8c868805b8ed9f.png) [@system](https://forum.syncthing.net/u/system)
#### Post date: [February 1, 2019, 9:18pm UTC](https://forum.syncthing.net/t/freenas-syncthing-plugin-permissions-strangeness/12622/10 "2019-02-01T21:18:26Z")

</div>

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