Error updating .htaccess file, not enough permissions?

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.

Greeds and thanks
Tom.

Please report such ideas directly to the bugtracker on github.com/nextcloud/server/issues, it is easier to track them there.

I get this same error, but i do have the overwrite.cli.url parameter specified (in config.php). Running the same command.

actually, turns out I just needed to update the perms before I run the command and then change the perms back.

Which permissions did you set and reset? I have the same problem.

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.

1 Like

It turned out the permissions were fine. The overwrite.cli.url variable has to contain a trailing “/”. This solved the issue for me.

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.