When using the occ maintenance:update:htaccess command i got the error:
Error updating .htaccess file, not enough permissions?
But all permissions were set correctly.
In my case the problem was, that in the config-file the paramter ‘overwrite.cli.url’ was not set.
In lib/private/Setup.php on lines 420 and following false will be returned, when there is no ‘overwrite.cli.url’ for the maintenance:update:htaccess command.
This ends in the error-message above.
I would suggest to give another - less confusing - error here, because it is not a matter of write-permissions, when a line in config-file is missing.
It’s been I while but I think I just needed to do a recursive chmod on the nextcloud-data folder back to the owner of the folder? I don’t remember specifics, but I think the owner is/was www-data?
Sorry I can’t give more specifics, it’s been a while.
I wanted to drop in and say; this (re-applying ownership throughout the Nextcloud installation) seems to have fixed this problem for me. My installation was originally in an inconsistent state where root was the group (and sometimes owner) of some files. I ran sudo chown -R www-data:www-data /var/www/nextcloud which updated the permissions, then I ran the occ command mentioned before.