I am trying to change the location of nextcloud data directory after restore
docker exec --user www-data nextcloud php occ config:system:set datadirectory --value=/var/www/html/data
This fails with message that the data directory cannot be created. I assume this is because the data directory already exists
root@collab:~# docker exec --user www-data nextcloud php occ config:system:set datadirectory --value=/var/www/html/data
Your data directory is invalid
Ensure there is a file called ".ocdata" in the root of the data directory.
Cannot create "data" directory
This can usually be fixed by giving the webserver write access to the root directory. See https://docs.nextcloud.com/server/16/go.php?to=admin-dir_permissions
An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /var/www/html/lib/private/Console/Application.php:166
Stack trace:
#0 /var/www/html/console.php(96): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /var/www/html/occ(11): require_once('/var/www/html/c...')
#2 {main}root@collab:~#
Note, that when I enter the container as www-user I can create files / directories and the .ocdata file does exist and it readable for www-user.
My assumption was that this command would allow me to change the data directory. I think this is wrong. This command is used to create the data directory I think. A better name would be create
I think
occ config:system:create datadirectory
Having said that, what would be the correct way to change the datadirectory location in config.php?