Latest News:
*New 11.2 series Release:
2019-06-20: XigmaNAS 11.2.0.4.6766 - released!

*New 12.0 series Release:
2019-06-20: XigmaNAS 12.0.0.4.6766 - released!

We really need "Your" help on XigmaNAS https://translations.launchpad.net/xigmanas translations. Please help today!

Producing and hosting XigmaNAS costs money Please consider donating for our project so that we can continue to offer you the best.
We need your support! eg: PAYPAL

Problems with permissions and Syncthing service

Open source file synchronization tool.
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Problems with permissions and Syncthing service

#1

Post by Oklahoma » 14 Feb 2016 23:39

Running an HP N40L server and NAS4free version 10.2.0.2 - Prester (revision 2268)

I don't consider myself a novice with Linux/Unix permissions but I am having a little trouble configuring Syncthing to use user datasets. Where I am getting tripped up is configuring permissions. I can't quite wrap my head around where my problem is and I hope that someone here may be able to point out where I went wrong.

Syncthing is set up to use user “sync” and group “syncthing”. It is also using /mnt/ZFSPool1/sync for a home mount for its own configuration and files and can read and write this dataset with no problem. This dataset is configured with owner “sync” and group “syncthing”. Also “sync” is configured with the additional groups “everyone” “admin” “staff” “owners” “supervisors-user1” (that's a group containing supervisor 1 and 2 and user1) “supervisors-user2” and “supervisors-user3”. Maybe all the groups are overkill but I didn't want it to have any problems accessing what it needed to.

Where I have trouble is accessing user space. I am getting an error on the Syncthing Administrative WebGUI saying:
“Loading ignores: open /mnt/ZFSPool1/user1/sync/Phone/Photos/.stignore: permission denied”
and:
“Stopping folder "nexus-photos" – stat /mnt/ZFSPool1/user1/sync/Phone/Photos/: permission denied”
Obviously, there is a permission problem with /mnt/ZFSPool1/user1/sync/Phone/Photos.
/mnt/ZFSPool1/user1/sync/Phone/Photos has a user as “user1” and group “owners”.

User “sync” is in the group “owners” so why can't it access dataset /mnt/ZFSPool1/user1/?

Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Re: Problems with permissions and Syncthing service

#2

Post by Oklahoma » 14 Feb 2016 23:40

Also dataset /mnt/ZFSPool1/user1/sync/ has a check in “read” “write” and “execute” for owners and groups but others is unchecked. Putting a check in others (and restarting Syncthing) yields only one error:
“Stopping folder "nexus-photos" - open /mnt/ZFSPool1/user1/sync/Phone/Photos/.stfolder: permission denied”
It seems to me that it should be all or nothing. Either it can write to /mnt/ZFSPool1/user1/ or it cannot. Removing the checks in others brings back both:
“Loading ignores: open /mnt/ZFSPool1/user1/sync/Phone/Photos/.stignore: permission denied”
and:
“Stopping folder "nexus-photos" – stat /mnt/ZFSPool1/user1/sync/Phone/Photos/: permission denied”

Any pointers that you could offer would be appreciated.

bewoco
Starter
Starter
Posts: 24
Joined: 23 Apr 2015 14:26
Location: Germany
Status: Offline

Re: Problems with permissions and Syncthing service

#3

Post by bewoco » 15 Feb 2016 22:26

Reading the above my general question is: What permissions does Syncthing need in any data folder "zzz" to sync it with elsewhere?

My idea is, in general Syncthing needs r and w permissions to sync in both directions and to create the .stfolder.
Furthermore in general the owner of data folder "zzz" is another user "xy" (manager) but not syncthing.

So Syncthing should be in the Group having Access to "zzz" or should Syncthing be in the admin group?

bewoco
NAS4Free 11.2.0.4 (revision 6766) x64-embedded on HP ProLiant N54L with AMD Turion(tm) II Neo Dual-Core Processor 4096 MB ECC RAM;
NAS4Free 11.2.0.4 (revision 6625) x64-embedded on Acer H341 with Intel Atom D410 4MB RAM

Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Re: Problems with permissions and Syncthing service

#4

Post by Oklahoma » 16 Feb 2016 05:55

Thank you, bewoco for your reply.
bewoco wrote:Reading the above my general question is: What permissions does Syncthing need in any data folder "zzz" to sync it with elsewhere?
bewoco
Yes, this is my question too, and I don’t have an answer.
bewoco wrote: My idea is, in general Syncthing needs r and w permissions to sync in both directions and to create the .stfolder.
Furthermore in general the owner of data folder "zzz" is another user "xy" (manager) but not syncthing.

So Syncthing should be in the Group having Access to "zzz" or should Syncthing be in the admin group?

bewoco
I think that we are thinking along the same lines.

You asked: "So Syncthing should be in the Group having Access to "zzz" or should Syncthing be in the admin group?" Syncthing is actually in both groups but it makes no difference.

My thought is Syncthing should be a system service with administrator rights and should be able to (by default) read and write to anywhere it wants without having to configure anything. If it doesn't do that, I am sure that there is a good reason, but I don't know what it is.

I am trying to remember when and where it was when I configured Syncthing to use a particular user profile so I could go back through it to make sure I didn't make an error somewhere. Perhaps you or someone else could point me in the right direction.

Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Re: Problems with permissions and Syncthing service

#5

Post by Oklahoma » 16 Feb 2016 16:15

I am still looking for where I configured Syncthing to have certain rights, so if anyone knows I would appreciate some help.

bewoco
Starter
Starter
Posts: 24
Joined: 23 Apr 2015 14:26
Location: Germany
Status: Offline

Re: Problems with permissions and Syncthing service

#6

Post by bewoco » 16 Feb 2016 23:57

Hello Oklahoma,

it seems as we share the same ideas.
I am new in using syncthing. Cause of lack of time I do my test perhaps a bit slowly and step by step.

Here is where I am:
The syncthing service is running. For that I previously created an empty folder on a part of the permanent storage.
The Web frontend is reachable and I have set an user and a Password but not using https, yet.
There is the predefined share "Default" at /var/tmp/syncthing/Sync/.
I had a look at owner and permissions: syncthing:wheel 700.
I created a new dataset "Synctest" with syncthing:wheel 777 and added it as a syncthing share. No Problem.
I added the existing dataset "Music" with owner user1:wheel 755 as syncthing share
-> Problem, Error message Stopping folder "Musik" - open /mnt/Data1/Musik/.stfolder: permission denied.
Changing the permissions for "Musik" to 775 Shows no difference, with 777 no error message as expected.
Finally I have not changed any user or Group configuration from the Default until now.
So "pw usershow syncthing -P" shows syncthing only belongs to group syncthing.
And that is my Problem, I think. Syncthing needs more permissions.
And I am back to my initial question: Put syncthing in which Group? Admin should work, but is it a risk?

bewoco
NAS4Free 11.2.0.4 (revision 6766) x64-embedded on HP ProLiant N54L with AMD Turion(tm) II Neo Dual-Core Processor 4096 MB ECC RAM;
NAS4Free 11.2.0.4 (revision 6625) x64-embedded on Acer H341 with Intel Atom D410 4MB RAM

Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Re: Problems with permissions and Syncthing service

#7

Post by Oklahoma » 18 Feb 2016 01:50

bewoco, sorry I really don't have any answers for you at this time. I would think put syncthng in the "Syncthing" group but it didn't help me. As soon as I get this figured out, I will be in touch. But in all honesty I am about to give up on the whole thing.

Interestingly enough I created a dataset exclusively for Syncthing and set it as Syncthings home folder. I then tried to share the very same folder through Syncthing but it told me permission denied! The strange thing is that Syncthing wrote several files there including a log file reporting that it did not have have permission to write to the SAME folder! I will check my path and report back.

Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Re: Problems with permissions and Syncthing service

#8

Post by Oklahoma » 18 Feb 2016 05:21

Well I recreated my server in virtualbox so I could play with it and break it. It seems that whatever folder I pick, including "/var/db/syncthing" that Syncthing suggests, Syncthing cannot write to it. I have configured Syncthing on several other systems without a problem. Is there anyone that actually has Syncthing working on NAS4free???

bewoco
Starter
Starter
Posts: 24
Joined: 23 Apr 2015 14:26
Location: Germany
Status: Offline

Re: Problems with permissions and Syncthing service

#9

Post by bewoco » 18 Feb 2016 22:06

Hi, some news.
Now I have put syncthing in group "wheel" using a postinit command (file).
Although group wheel has rwx access to all my datasets (Samba shares) the already known
Error message: "stopping folder xxxx - open /mnt/Data1/xxxx/.stfolder: permission denied"
comes up.
Furtheron I figured out that if I manually add a .stfolder in any share to be synced before adding it to syncthing seems to solve the Problem (no error message).
So the Problem seems to be the initial creation of .stfolder 644 syncthing: wheel.
NAS4Free 11.2.0.4 (revision 6766) x64-embedded on HP ProLiant N54L with AMD Turion(tm) II Neo Dual-Core Processor 4096 MB ECC RAM;
NAS4Free 11.2.0.4 (revision 6625) x64-embedded on Acer H341 with Intel Atom D410 4MB RAM

Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Re: Problems with permissions and Syncthing service

#10

Post by Oklahoma » 19 Feb 2016 21:47

Thank you bewoco. Seriously, thank you. I had hoped to be an help to you but I have been very busy today and have not had much time to focus on this problem.

I have not had an opportunity to implement your suggestions yet, but I have a couple of questions.

"Now I have put syncthing in group "wheel" using a postinit command (file)." Although I am a Linux user, I honestly don’t know what a postinit file is and how to modify it. Can you share a little insight?

Furthermore, I cannot find .stfolder anywhere on my system. Where did you get it from? _ Never mind, I just found it in a tmp folder. Imagine that - a tmp folder. Really???

"So the Problem seems to be the initial creation of .stfolder 644 syncthing: wheel." Yep. that explains why I am having so much trouble. I just would have never guessed that if Syncthing can write a log file to a particular folder, it would not be able to write .stfolder to the very same folder. Odd.

I was actually looking into setting up the Syncthing extension as described here: viewtopic.php?f=71&t=7821#p46282 I just haven’t gotten very far. Your solution would be better.

So is your Syncthing now working correctly?

bewoco
Starter
Starter
Posts: 24
Joined: 23 Apr 2015 14:26
Location: Germany
Status: Offline

Re: Problems with permissions and Syncthing service

#11

Post by bewoco » 20 Feb 2016 00:20

Hi Oklahoma,

concerning your questions here some screen shots.
Cmd.JPG
group.JPG
For the .stfolder file see /var/tmp/syncthing/Sync. Thats the Default folder of Syncthing on NAS4FREE.

On my NAS4FREE Syncthing is running and set up so far. I have also created a test dataset for syncing tests. I don't like to risk any data.
Tbd: Syncing test with another device. Will take some days. No time.
You do not have the required permissions to view the files attached to this post.
NAS4Free 11.2.0.4 (revision 6766) x64-embedded on HP ProLiant N54L with AMD Turion(tm) II Neo Dual-Core Processor 4096 MB ECC RAM;
NAS4Free 11.2.0.4 (revision 6625) x64-embedded on Acer H341 with Intel Atom D410 4MB RAM

Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Re: Problems with permissions and Syncthing service

#12

Post by Oklahoma » 20 Feb 2016 04:45

Very clever. Good job, and thanks for the help. I have been very busy the past couple of days but I hope to implement your solution this weekend. Thanks again for the help. I will let you know if it worked for me.

Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Re: Problems with permissions and Syncthing service

#13

Post by Oklahoma » 23 Feb 2016 02:23

Hello All, (I hope, or maybe at least bewoco)

I went in to system|advanced|command scripts to set up my homemade syncting permissions and I found something that I didn't see in bewoco's example; a scrip was set up to start syncthing on startup. How nice. Looks like it is pointing to /etc/Syncthing/syncthing/syncthing_start.php - only problem is that the location doesn’t exist! Now I am not surprised that I cannot access syncthing. Also the "services" page also shows that it is enabled but not running. My server has been running for days and I had left it with syncthing running so at some point it got killed by something.

My only theory is that without syncthing added to wheel like in bewoco's example, something goes through and kills it AND DELETES IT - perhaps because it doesn’t have permission to exist?

I can't describe how frustrating this is. In previous days I was fightng with it because syncthing was writing a log to a pacticular folder but LATER CANNOT WRITE TO IT? REALLY???

I will work on it a bit more; finish setting it up like bewoco suggested and see where the server is and where my sanity is.

Thanks

Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Re: Problems with permissions and Syncthing service

#14

Post by Oklahoma » 23 Feb 2016 03:43

Well, maybe I am halfway there now? I did the tweaks that bewoco sugessted, rebooted the server and syncthing is definitely running. (It's listed in both processes and services.) But I cannot get the web configuration page to load. I am not sure what to do to fix it. I will poke around a little and see what happens. Anyone know what commands will restart the webserver for syncthing?

Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Re: Problems with permissions and Syncthing service

#15

Post by Oklahoma » 23 Feb 2016 03:59

Rebooted again but no web service. Hmmm........

Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Re: Problems with permissions and Syncthing service

#16

Post by Oklahoma » 23 Feb 2016 04:42

Thinking out loud: Perhaps the port changed somehow?

Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Re: Problems with permissions and Syncthing service

#17

Post by Oklahoma » 23 Feb 2016 04:49

Under status|processes there are two syncthngs; both of them have a state of "uwait". Does that mean that they have not started yet?

User avatar
crest
Hardware & Software Guru
Hardware & Software Guru
Posts: 862
Joined: 02 Jul 2012 22:25
Location: Vienna, Austria - GMT+1
Status: Offline

Re: Problems with permissions and Syncthing service

#18

Post by crest » 23 Feb 2016 11:11

Oklahoma wrote:Under status|processes there are two syncthngs; both of them have a state of "uwait". Does that mean that they have not started yet?
Hello Oklahoma,

Maybe I can help to sort out some issues.

First of all, it seems you fiddled a bit too much on several places so let's try to do a 'reset' .
1. Perform a

Code: Select all

killall syncthing
Command in the CLI, there should be no longer a synching process in the process list.

2. You mentioned a postinit script /etc/Syncthing/syncthing/syncthing_start.php in one of your previous post, remove this entry and also if there is a preshutdown script syncthing_stop.php.This is an artefact from your previously mentioned try of the Syncthing extension. Btw, if you want to use extensions ALWAYS install them in a persistent directory (like /mnt/data_something on a single disk or on a dataset to let it survive a reboot, your path /etc/.... was definitely the wrong place. Also don't use encrypted devices, only if they are automatically mounted BEFORE any postinit extension start script is executed).

3. Finally open the file /cf/config/config.xml in the built-in editor in the WebGUI and scroll down to the very end of the file. If you find there an entry

Code: Select all

<syncthing>
....
...
</syncthing>
delete all the lines including the open and close syncthing tags and save the file. BEFORE performing step 3 backup the configuration inside the WebGUI just in case ...

After a reboot you can be sure that there is no influence between the built-in and extension syncthing (to answer your - not asked ;) - question: why are there two syncthing applications? Because I wrote the extension long time before syncthing was included into the N4F native installation but the extension is still maintained and useful in some cases).

I know that I didn't help with your main issue but since I'm not in my home office for a while I would recommend to get in touch with user MikeMac, his blog gives a lot of very detailed information and afaik also for boxed syncthing (written in Russian but with the help of Google Translator also readable for non native speakers).

Otherwise you could also give the extension a try (remember the persistent place for installation), as far as I remember there were no permission problems with several hundred installations ... ;)

Good luck and regards
crest

NAS1: 11.2.0.4 - Omnius (Revision 6766) x64-embedded; MSI 760GM-P23; AMD Athlon(tm) II X2 250 7.58GiB RAM
NAS2: 11.2.0.4 - Omnius (Revision 6766) x64-embedded; MSI MS-7369; AMD Sempron(tm) LE-1250 8022MiB RAM

UPS: APC Back-UPS ES 550G
Extensions: OneButtonInstaller, Extended GUI, NextOwnCloud, BitTorrent Sync, Syncthing, Downloady, Midnight Commander, NCDU, MySQL, Rclone

Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Re: Problems with permissions and Syncthing service

#19

Post by Oklahoma » 26 Feb 2016 02:21

Thank you Crest for your input. I tried your suggestion but was unable to complete step number 3. I was logged in as root by ssh but when I tried to save it apparently I didn't have permission to write the changed file. Did I mention that I was root? Seems to me I should be able to write to ANYTHING as root. Maybe it was a fluke. I will give it another shot and see what happens. If not, maybe I will restore the settings from a backup and see if that helps to clear out the cruft. I may be able to give it a shot tonight or tomorrow. I just wanted to say thanks for helping and I will let you know when I get it going.

User avatar
crest
Hardware & Software Guru
Hardware & Software Guru
Posts: 862
Joined: 02 Jul 2012 22:25
Location: Vienna, Austria - GMT+1
Status: Offline

Re: Problems with permissions and Syncthing service

#20

Post by crest » 26 Feb 2016 02:56

Oklahoma wrote:Thank you Crest for your input. I tried your suggestion but was unable to complete step number 3. I was logged in as root by ssh but when I tried to save it apparently I didn't have permission to write the changed file. Did I mention that I was root? Seems to me I should be able to write to ANYTHING as root. Maybe it was a fluke. I will give it another shot and see what happens. If not, maybe I will restore the settings from a backup and see if that helps to clear out the cruft. I may be able to give it a shot tonight or tomorrow. I just wanted to say thanks for helping and I will let you know when I get it going.
Hello,
for step 3 I mentioned to use the built-in editor inside the WebGUI, you can find it under Advanced | File editor, here you can save changes to config.xml.

NAS1: 11.2.0.4 - Omnius (Revision 6766) x64-embedded; MSI 760GM-P23; AMD Athlon(tm) II X2 250 7.58GiB RAM
NAS2: 11.2.0.4 - Omnius (Revision 6766) x64-embedded; MSI MS-7369; AMD Sempron(tm) LE-1250 8022MiB RAM

UPS: APC Back-UPS ES 550G
Extensions: OneButtonInstaller, Extended GUI, NextOwnCloud, BitTorrent Sync, Syncthing, Downloady, Midnight Commander, NCDU, MySQL, Rclone

Oklahoma
Starter
Starter
Posts: 16
Joined: 14 Feb 2016 20:56
Status: Offline

Re: Problems with permissions and Syncthing service

#21

Post by Oklahoma » 27 Feb 2016 05:01

Well, I got everything cleaned out and looking good. Thank you, Crest.

I went back and tried to get syncthing running again and what do you know, I get permission errors again!
2016-02-26 22:36:28: Loading ignores: open /mnt/ZFSPool1/Oklahoma/sync/Laptop/Documents/.stignore: permission denied

2016-02-26 22:36:28: Stopping folder "Oklahoma-Laptop-Documents" - stat /mnt/ZFSPool1/Oklahoma/sync/Laptop/Documents/: permission denied
Unbelievable! Right back where I started from!

This is after I have left in place bewoco's postint permission script trick.
The "Oklahoma" dataset is part of the "owners" group and "others" is not checked in read/write/Execute under "mode". This should be self-explanatory as to why. Syncthing is part of "wheel" and "owners" group.

I am not sure what to do next.

bewoco
Starter
Starter
Posts: 24
Joined: 23 Apr 2015 14:26
Location: Germany
Status: Offline

Re: Problems with permissions and Syncthing service

#22

Post by bewoco » 09 Mar 2016 00:17

Hi Oklahoma,
syncthing is working for me from NAS4FREE (master) to another OpnMediaFault NAS, I have set up recently.
Other direction not tested so far.
But concerning access rights I am just discovering ACL which can exist on top on the normal access for owner, group, other.
Give it a look.
If you give the ls -l command and there is a plus sign (+) behind the rights info, ACL is active.
With getfacl <dir> or getfacl <file> you get more info. perhaps you have accidently activated something unwanted?

bewoco
NAS4Free 11.2.0.4 (revision 6766) x64-embedded on HP ProLiant N54L with AMD Turion(tm) II Neo Dual-Core Processor 4096 MB ECC RAM;
NAS4Free 11.2.0.4 (revision 6625) x64-embedded on Acer H341 with Intel Atom D410 4MB RAM

kenZ71
Advanced User
Advanced User
Posts: 403
Joined: 27 Jun 2012 20:18
Location: Northeast, USA
Status: Offline

Re: Problems with permissions and Syncthing service

#23

Post by kenZ71 » 09 Mar 2016 03:48

I tried for a few hours last night then gave up.

This morning I setup NFS and ran rsync via command line. Worked great.
11.2-RELEASE-p3 | ZFS Mirror - 2 x 8TB WD Red | 28GB ECC Ram
HP ML10v2 x64-embedded on Intel(R) Core(TM) i3-4150 CPU @ 3.50GHz

Extra memory so I can host a couple VMs
1) Unifi Controller on Ubuntu
2) Librenms on Ubuntu

leejamescn
NewUser
NewUser
Posts: 5
Joined: 10 Aug 2017 08:25
Status: Offline

Re: Problems with permissions and Syncthing service

#24

Post by leejamescn » 17 Jan 2018 11:55

just try these command line:
chown -R syncthing:syncthing /mnt/yourpath
chmod -R 775 /mnt/yourpath
in webUI "tools->command page" or in SSH terminal.

maobernie
NewUser
NewUser
Posts: 3
Joined: 14 Jun 2019 06:55
Status: Offline

Re: Problems with permissions and Syncthing service

#25

Post by maobernie » 18 Jun 2019 06:04

Hi, use command line in menu 'Tool', change syncthing data folder: chmod +777 /your/data/folder/contain/files, and reset syncthing service. This method can solve it.

Post Reply

Return to “Syncthing”