NextBox: occ command

Hi, I’m trying to setup a 2AF for all NextCloud users with Twofactor-gateway but I need to run occ command from a shell (Admin Documentation - Nextcloud TwoFactor Gateway).
I can connet to the NextBox via ssh but I cannot run occ as netxuser nor with sudo. The path of executable of occ isn’t in $PATH probably or isn’t instlled?

nextuser@nextbox:~ $ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games

nextuser@nextbox:~ $ occ --help -bash: occ: command not found

Hey @aborrone,

Yes, occ is not in $PATH as Nextcloud runs in a Docker container, to run occ you’ll have to run the following as root (change to root using sudo -s as nextuser):

docker exec -it -u www-data nextbox-compose_app_1 /var/www/html/occ

best

Thankyou!

1 Like

Hi, I’ve tried to setup an app using the occ command and ran into a similar problem after running commands through ssh. However, when I used the code in the solution, terminal came back with this response:

nextuser@nextbox:~ $ docker exec -it -u www-data nextbox-compose_app_1 /var/www/html/occ memories:index
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/nextbox-compose_app_1/json: dial unix /var/run/docker.sock: connect: permission denied

The command is there to index images uploaded onto Nextcloud for use in the app “Memories”.

Please could someone indicate to me how I may be able to get the command to work correctly.

The current Nextcloud version I’m using is 25.0.4.

Hi,

you will need root permission for docker. (change to root using sudo -s as nextuser)

Best
Simon