Configure Nextcloud to make occ work in a restricted chroot environment

From DiscordDigital Wiki
Jump to navigation Jump to search

In some conditions you may want to host a Nextcloud instance on a server that has restrictions set, may it be from a security aspect or the reason to be able to have mandates.

This setup allows a user to use occ inside a chrooted SSH environment, however a couple changes need to be made to the Nextcloud "config/config.php" file.

Change 1: Adjusting the dbhost value (If database is local)

Edit the config.php file and change the dbhost, replace localhost with like this:

'dbhost' => '',

Change 2: Adjust the datadirectory value

Small Warning.png Adjust path to match relative location of data folder if necessary.

'datadirectory' => realpath(__dir__ . '/../data'),


Now we should be able to run "php occ" inside our chrooted SSH environment, while still being able to load the Nextcloud instance.