Linux permissions to access user data files in Nextcloud server via ssh

I have set up a Nextcloud server on Ubuntu using Apache and MariaDB.

I would like to access the data files for users under /var/www/nextcloud/data/[user] via ssh to back up the data files regularly to my Truenas server. Access would be over ssh, and only read access would be required. The ssh user would be patrick, which is one of the users.

The problem is that the data files have ownership www-data (user and group). I could add patrick to the www-data group, which should solve the problem and allow read access for user patrick over ssh, but I’m afraid that I could mess something up if I do so.

Does anyone have any information or suggestions?

If you just copy /var/www/nextcloud/data/* to your Truenas:

  • What possible problems do you have in mind?

If it comes to restore: Just copy the files back, modify owner on your NC server and do a sudo -u www-data php /var/www/nextcloud occ files:scan --all

Thanks. I have now set it up that way. I did have to add user “patrick” to group www-data in order to get access, but there haven’t been any apparent problems with doing so.