Folder with www-data permissions

I have a question if you can help me, please. I have created a folder in the root called ncdata which is for the nextcloud data (Debian 10), and I had changed the owner to www-data, the folder permissions are rwxrwx—, I use syncthing to sync the data to another backup server (FreeNAS). When I added the ncdata to syncthing it says no permission so I chmod 777 -R ncdata, and works fine but after a few minutes, the permissions automatically return to its origin which is 770! what is the problem in your opinion? And could I when adding the folder to the syncthing add it with www-data permissions? Best Regards.

You could add the user syncthing runs as to the group that has permissions.

I did it and same issue, any new ideas please.

Meaning that syncthing still complains about permissions? Then there’s something more going on.

(As a sidenote, it sounds like you might want to look into a solution specifically designed for backup.)

yes same problem, and the mysterious thing is the permission on the folder keep changed suddenly from 777 to 770. As you mentioned i will start searching for other way to sync this folder (a backup solution). Thank you dear for your reply.

sounds like nextcloud checking and “correcting” permissions. If you add syncthing user to the group owning the dir 770 is just fine.

can I know what is the user of syncthing you are talking about? is it the current logged in user or a special user created by syncthing when extracted from the downloaded file from the website? and I feel as you said that nextcloud each time access the data folder it correct the permissions.

The user syncthing runs as. If you haven’t specifically made different arrangements, this will be the current user. (I believe it is quite rare to change this.)

Under Debian, you’d use sudo adduser username groupname, where username is your username and groupname is in all likelihood www-data, in order to do what I asked you first. You’ll need to log out and back in for this to take effect. This will mean that the second 7 in the permissions applies to syncthing, and so it won’t matter that the permissions get configured back to 770.