%
image/svg+xml

(tip) Nextcloud Php Chroot OpenBSD

Article published the ; modified the
One minute to read

This article has 170 words.
RAW source of the article:
Commit version: e21600e

Error: Invalid data directory

Under OpenBSD, Web service and PHP are under chroot. In fact, the command occ can not run!

When you try, we get this message:

Code: sh

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

To resolve this problem is very easy!

Edit the file config nextcloud/config/config.php, to modify the value of datadirectory, as:

'datadirectory' => ((php_sapi_name() == 'cli') ? '/var/www' : '') . '/htdocs/data',

Of course, the /htdocs/data directory must correspond to your real case.

Now, you can use without problem the occ command.

After, dont forget to delete yours modifications before going to the web interface, otherwise you will not to be able to connect!

TL;DR

KiSS:

  • To “enable” occ: sed -i -e 's#/htdocs#/var/www/htdocs#' nextcloud/config/config.php
  • To “disable” occ: sed -i -e 's#/var/www/htdocs#/htdocs#' nextcloud/config/config.php

Acknowledgement

I would liket to thank @h3artbl33d who found this tips…