"not enough permissions" when trying to setup pretty urls

Nextcloud version: 14.0.2
Operating system and version: Debian 9.5
Apache or nginx version: Apache 2.4.25
PHP version: 7.2

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. setup the config.php as described in https://docs.nextcloud.com/server/13/admin_manual/installation/source_installation.html#apache-web-server-configuration
  2. Follow the steps described in the Pretty URLs section

The result of the occ command is:
Error updating .htaccess file, not enough permissions or "overwrite.cli.url" set to an invalid URL?
The permissions of the .htaccess file are correct, the overwrite.cli.url is correct. The corresponding entry in the log seems to be unrelated, but it shows up each time the command is issued.

The output of your Nextcloud log in Admin > Logging:

No cache entry found for /appdata_ocypwgxpu10n/theming/images/background (storage: local::/var/lib/nextcloud/mysite/, internalPath: appdata_ocypwgxpu10n/theming/images/background)

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'xxxxx',
  'passwordsalt' => 'xxxxxx',
  'secret' => 'xxxxx',
  'trusted_domains' => 
  array (
    0 => 'cloud.mysite.de',
  ),
  'datadirectory' => '/var/lib/nextcloud/mysite',
  'logfile' => '/var/lib/nextcloud/mysite/nextcloud.log',
  'loglevel' => 0,
  'overwrite.cli.url' => 'https://cloud.mysite.de',
  'htaccess.RewriteBase' => '/',
  'dbtype' => 'mysql',
  'version' => '14.0.2.2',
  'dbname' => 'nextcloud_xxxxx',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxxxx',
  'installed' => true,
  'integrity.check.disabled' => false,
  'mail_from_address' => 'nextcloud',
  'mail_smtpmode' => 'sendmail',
  'mail_domain' => 'mysite.de',
  'trashbin_retention_obligation' => 'auto,10',
  'updatechecker' => true,
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
  'appstore.experimental.enabled' => false,
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/nextcloud-mysite/apps',
      'url' => '/apps',
      'writable' => true,
    ),
  ),
  'maintenance' => false,
  'theme' => '',
  'updater.release.channel' => 'stable',
  'updater.secret' => 'xxxxxxxx',
);

The output of your Apache/nginx/system log in /var/log/____:

Nothing relevant

On another installation I get the same error, but there is no entry in the log flle.

the problem is the permissions from apache:apache to root:root, apach4e can not write files on an root:root owned file, take a look with “ls -al” in the folder of the files, if there the owner of the files root:root and not the apache, can apache not write the chown root:root 'ed files so should you use the apache user as account…
“sudo passwd root”
"su - " => give the root pw

cd your nextcloud-folder
ls -al (you see the root owned files imho)
you can change it via chown, but this is in this place a bad choice ,
you should go in the nextcloud server as root, delete the whole folders and files
(save your config/config.php !!!)
the nc-folder is emty,

su - apache

so, change the user root to user apache or html, what ever you system use for webserver

wget https://download.nextcloud.com/server/releases/nextcloud-14.0.3.tar.bz2

take mc for going in and extract the pack as user apache/or/httpd

to be all files owned by the webserver-apache/http user
then works it also with pretty well running, because then be the files writeable by apache/httpd user

at all Linuxdistriebutions is’t more better to have a real root count and not only a sudo
you can make this “sudo pwd root” setting a password and then can you also working with “screen”, a multitasking tty program where makes possible to let run diffrent programms in differen screen’s
make screen --help or “man screen” “apt-get install screen”

best regards
blacky

There are no root owned files in my folder. They are all owned by www-mysite, and the apache vhost runs as user www-mysite. Also I used that user for the occ command.

Something must prevent it from being writable …

or check the writing right’s

can you also view with ls -al

thank you, but I know how to use the ls command. This is a root server, I do all the administration. I would not ask for a simple permission problem. What’s more, this problem occurs on three installations on two different servers.

hihi… okey, man kann ja an dieser stelle versuchen zu helfen… :wink:
well… so on this place it’s not… maybe have another one a good suggestion …

best regards
Blacky

1 Like

It turns out that the overwrite.cli.url option has to contain a trailing “/”. I found this hint here:
https://help.nextcloud.com/t/14-0-0-maintenancehtaccess-fails/37220/2
Indeed this is stated correctly in the NC 14 documentation. I had read the NC 13 doc and ignored the changes. My fault.

3 Likes