Nextcloud OCC permission error

My YunoHost server

Hardware: Old laptop or computer
YunoHost version:
I have access to my server : through the webadmin | direct access via keyboard / screen
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

Running OCC on root works fine with this command:

sudo -u nextcloud php8.2 --define apc.enable_cli=1 occ

However, running it as my regular user that has sudo access I get permission error.

Sorry, user xx is not allowed to execute '/usr/bin/php8.2 --define apc.enable_cli=1 occ
' as nextcloud on mydomain.tld.

What exactly is the problem here?
File permission, or user/groups?

1 Like

Well in every case it should run as nextcloud, not root, not your user … This is what sudo -u nextcloud does (from root anyway)

Why do you want to run it from your user x_x

i’m connecting to the yunohost server via ssh, and my admin user xx.
When I run the

sudo -u nextcloud php8.2 --define apc.enable_cli=1 occ

I get the mentioned error.
So I run it as nextcloud with my xx user logged in to the server.

Should I log in to the server as nextcloud??

I still don’t understand what you’re trying to achieve … you’ve shown that you’re running the command fine as root sooooo

# Step 1 : become root
sudo su
# Step 2 : run the OCC command ?
sudo -u nextcloud php8.2 --define apc.enable_cli=1 occ

Yep. That works.
Was hoping it could run without beeing the root user.

Is it not supposed to work that that way?

Well again, technically the actual occ command runs as nextcloud, not as root, but only root can “become” nextcloud, so you have to be root first. Again, still don’t know what you’re trying to achieve, if you’re just trying to optimize convenience or something else …

Ok. Thanks.
It was for convenience.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.