Using Nextcloud’s occ command without sudo

When trying to use Nextcloud’s occ (ownCloud Console) command and it’s not possible to use sudo or su (installation on Debian GNU/Linux 11), you can try with the following command (you may have to change the paths to php and occ).

runuser --user www-data -- /usr/local/bin/php /var/www/html/occ user:list