Syncthing and folder permisions

Hello,

I’m using DietPi for some time and it works very well. Today I installed Syncthing (via DietPi-Software)to sync some data. Installation went well, I can connect via web interface but when I’m adding folder to sync I receive:

Failed to create folder marker: mkdir /mnt/m2/.stfolder: permission denied

As I understood the problem is with folder permissions. I already found that Syncthing uses dietpi user by default and it’s ok for me. But how can I add dietpi user to be able read and write in /mnt/m2 without changing privilages of other users?

ls -l gives that:

pcbackup@T620:/mnt/m2$ ls -l
total 360
drwxrwxr-x 3 root     root   4096 Aug 18 11:34 dietpi-backup
drwx------ 2 root     root  16384 Jul 23 11:45 lost+found
drwxr-xr-x 2 pcbackup root 344064 Aug 17 22:52 DIR1
drwxr-xr-x 2 pcbackup root   4096 Jul 23 11:51 DIR2

Hi,

short question. /mnt/m2 is an axternal disk? Is it ext4 file system format? Can you check?

lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
ls -la /mnt/m2

It’s internal M.2 Sata drive with one partition formated to ext4

lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
sdb                      447.1G  0 disk                                                  
\u2514\u2500sdb1 ext4              447.1G  0 part /mnt/m2



ls -la /mnt/m2
total 368
drwxrwxr-x 6 root     root   4096 Aug 18 14:06 .
drwxr-xr-x 8 root     root   4096 Aug 18 14:18 ..
drwxrwxr-x 3 root     root   4096 Aug 18 11:34 dietpi-backup
drwx------ 2 root     root  16384 Jul 23 11:45 lost+found
drwxr-xrw- 2 pcbackup root 344064 Aug 17 22:52 DIR1
drwxr-xr-x 2 pcbackup root   4096 Jul 23 11:51 DIR2

ok the entire folder /mnt/m2 is writable to user root only. You would need to change owner for this mount point to user dietpi

chown dietpi:dietpi /mnt/m2/

If I will change owner will it have imapact for something else?

EDIT: I tried and it’s better :wink: Now I have this:

XYZ sync	failed to setup inotify handler. Please increase inotify limits, see https://docs.syncthing.net/users/faq.html#inotify-limits

I follow link and from root account input this:

echo "fs.inotify.max_user_watches=204800" | sudo tee -a /etc/sysctl.conf

I also restart Syncthing but it didn’t help. Should I restart Dietpi also?

Hi,

there is following statement on the link you shared

This only takes effect after a reboot.

So yes, a reboot might be required

I was away for few days …

When I rebooted computer now I get:

error while traversing /mnt/m2/dietpi-backup/data/root: permission denied

It’s a folder when I make DietPi system drive backup. Should I change owner also? Will it interupt backup?

Where does the issue/error is shown?

in a frame in main window just before “folders” and “this device”

ok, I guess I know what you are trying to do. You are trying to save DietPi backup via Syncthing. Correct?

This might not be working on a default setup because Syncthing is executed as user dietpi and will not have access to folders that are accessible by user root only, like the root user home directory.

Something I’m not recommending is to execute Syncthing as root user. As well Syncthing themselves will complain about it

2021-08-25 22:03:41: Syncthing should not run as a privileged or system user. Please consider using a normal user account.

But it should work.