Nextcloud version: 18.0.4
Operating system and version: Ubuntu 18.04
Apache version: 2.4.29
PHP version: 7.2
Hey guys, hope you are doing well.
I want to do nightly backups of my nextcloud instance to a remote server using a bash script that I’ll call by a cronjob.
Because I don’t want to break anything, I created a new user on my machine named
nc-backup. The idea is to let the bash script be run as the user nc-backup and to give nc-backup only read permissions to all the directories that shall be backed up. So I added backup to the group www-data and changed the permissions of the nextcloud data dir so that members of the group www-data can only read from this directory (the owner www-data ofc still has full access)
The problem I am facing is that nextcloud maintenance mode may only be enabled by the www-data user. Before backing up I want my script to enter maintenance mode and then disable it once the backup is done. I can’t use sudo since it requires a password and I don’t want to put the user password into the bash script.
Is there any way to do this or should I rather run the script as root user?