Syncthing permissions

Installed on pi3 and android, but can’t seem to get the sync to start looks like a permissions issue.

I’ve tried chmod 777 to no avail

Any help is much appreciated :smiley:

<small>2024-03-14 21:45:34:</small> Failed to create folder root directory stat /mnt/wd5tb0abd/syncthing/pi: permission denied
<small>2024-03-14 21:45:34:</small> Error on folder pi: stat /mnt/wd5tb0abd/syncthing/pi: permission denied
<small>2024-03-14 21:45:34:</small> Loading ignores: lstat /mnt/wd5tb0abd/syncthing/Camera/.stignore: permission denied
<small>2024-03-14 21:45:34:</small> Failed to create folder root directory stat /mnt/wd5tb0abd/syncthing/Camera: permission denied
<small>2024-03-14 21:45:34:</small> Error on folder "Camera" (xq-ct54_899r-photos): stat /mnt/wd5tb0abd/syncthing/Camera: permission denied
root@DietPi:/mnt/wd5tb0abd# ls -l
total 52
drwxrwxrwx 6 www-data www-data  4096 Mar 14 16:30 admin
drwxrwxrwx 8 www-data www-data  4096 Mar 14 16:18 appdata_ocybaannumpx
drwxrwxrwx 2 www-data www-data  4096 Mar 14 11:50 files_external
-rwxrwxrwx 1 www-data www-data     0 Mar 14 11:45 index.html
drwxrwxrwx 2 www-data www-data 16384 Mar 13 21:25 lost+found
-rwxrwxrwx 1 www-data www-data 12255 Mar 14 16:25 nextcloud.log
drwxrwxrwx 2 www-data www-data  4096 Mar 13 23:13 photos
drwxrwxrwx 3 www-data www-data  4096 Mar 14 21:16 syncthing
-rwxrwxrwx 1 www-data www-data  1900 Mar 14 19:48 updater.log

What file system format the drive has?

Ext4

can you share following

ls -la /mnt/wd5tb0abd/syncthing/
root@DietPi:~# ls -la /mnt/wd5tb0abd/syncthing/
total 12
drwxrwxrwx 3 www-data www-data 4096 Mar 14 21:16 .
drwxrwx--- 8 www-data www-data 4096 Mar 14 21:02 ..
drwxrwxrwx 3 dietpi   dietpi   4096 Mar 14 21:16 pi

one more :smiley:

ls -la /mnt/
root@DietPi:~# ls -la /mnt/
total 40
drwxr-xr-x 10 dietpi   dietpi   4096 Mar 14 11:29 .
drwxr-xr-x 18 root     root     4096 Feb 21 20:12 ..
drwxr-xr-x  3 root     root     4096 Oct  4 22:39 dietpi-backup
drwxr-xr-x 10 dietpi   root     4096 Mar 14 20:49 dietpi_userdata
drwxrwxr-x  2 dietpi   dietpi   4096 Apr 13  2023 ftp_client
drwxr-xr-x  2 root     root     4096 Feb 11 15:22 md0
drwxrwxr-x  2 dietpi   dietpi   4096 Apr 13  2023 nfs_client
drwxrwxr-x  2 dietpi   dietpi   4096 Apr 13  2023 samba
drwxrwxrwx  9 dietpi   dietpi   4096 Oct 23 15:10 samsung500gb
drwxrwx---  8 www-data www-data 4096 Mar 14 21:02 wd5tb0abd

as you can see, whole folder wd5tb0abd is read/writable for user www-data only. You would need to give at least read permission for other or add user dietpi into group www-data.

I’m not sure where user www-data has come from. What’s the simplest fix?

Something along these lines?

chmod -R u+rw wd5tb0abd

You can start adding read permission for others to not open the folder widely :slight_smile:

chmod -R o+r /mnt/wd5tb0abd

ok I’ll give that a try - does it automatically apply to user dietpi or do I have to do something to tell it to apply for user dietpi?

root@DietPi:/mnt/wd5tb0abd# chmod -R o+r
chmod: missing operand after ‘o+r’

You need to specify the path, like

chmod -R o+r /mnt/wd5tb0abd
1 Like

Thanks thought it would have worked that out if I already cd into that directory - anyways seemed to have gone through now - cheers - still got the same error inside syncthing though - should I give it a reboot?

this should not solve permission issues, you would need to check the folders in question

Can you help me understand why this doesn’t just work out of the box? Do I need to be logging in using the dietpi user rather than root and installing things from dietpi-software that way?

It has nothing to do with the way you login. Its more the folder permission on your HDD. Somehow the whole drive seems to belong to web server user

so how can I just change the whole drive and everything inside it to belong to the dietpi user?

chown -R dietpi:dietpi /mnt/wd5tb0abd

But I would not do that. It seems your drive is used by Nextcloud. Means, all data should belong to www-data.

Ah so Nextcloud is the culprit - ok I’m just going to format the drive and start fresh with syncthing - couldn’t login to nextcloud it would just hang