[SOLVED] Permission Denied when moving, renaming or Deleting folder

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 21.0.5
Operating system and version (eg, Ubuntu 20.04): CentOS 7
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.6
PHP version (eg, 7.4): 7.4

The issue you are facing:
When trying to rename/move a folder, the following error occurs:

Fatal	webdav	Sabre\DAV\Exception: Failed to rename /Documents/Images to /Documents/Images2	
2021-10-03T16:05:47+0000
Error	PHP	Error: rename(/nextcloud/data/files/Documents/Images,/nextcloud/data/files/Documents/Images2): Permission denied at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#347	
2021-10-03T16:05:47+0000

When trying to remove the folder the following error occurs:

Error	PHP	Error: rmdir(/nextcloud/data/files/Documents/Images): Permission denied at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#128	
2021-10-03T16:07:41+0000
Error	PHP	Error: unlink(/nextcloud/data/files/Documents/Images/CentOS-7-x86_64-DVD-1908-v2.iso): Permission denied at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#123

This is not just for this specific example, but happens to all folders (I’ve tried), by multiple users.

Is this the first time you’ve seen this error? (Y/N): N
Have seen this error before, but not consistently.

Steps to replicate it:

  1. Try to delete or move/rename a folder

The output of your Nextcloud log in Admin > Logging:

See above

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

<?php
$CONFIG = array (
  'instanceid' => '*********',
  'passwordsalt' => '*********',
  'secret' => '*********',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '*********',
  ),
  'datadirectory' => '*********',
  'dbtype' => 'mysql',
  'version' => '21.0.5.1',
  'mysql.utf8mb4' => true,
  'overwrite.cli.url' => 'http://www.localhost/nextcloud',
  'dbname' => '*********',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '*********',
  'dbpassword' => '*********',
  'installed' => true,
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => ''*********',',
  'mail_domain' => '*********',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '*********',
  'mail_smtppassword' => '*********',
  'mail_smtphost' => '*********',
  'mail_smtpport' => '587',
  'default_phone_region' => '********',
  'theme' => '',
  'loglevel' => 0,
  'enable_previews' => true,
  'onlyoffice' => 
  array (
    'verify_peer_off' => true,
  ),
  'updater.release.channel' => 'stable',
  'preview_libreoffice_path' => '/usr/bin/libreoffice',
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\TXT',
    1 => 'OC\\Preview\\MarkDown',
    2 => 'OC\\Preview\\OpenDocument',
    3 => 'OC\\Preview\\PDF',
    4 => 'OC\\Preview\\MSOffice2003',
    5 => 'OC\\Preview\\MSOfficeDoc',
    6 => 'OC\\Preview\\PDF',
    7 => 'OC\\Preview\\Image',
    8 => 'OC\\Preview\\Photoshop',
    9 => 'OC\\Preview\\TIFF',
    10 => 'OC\\Preview\\SVG',
    11 => 'OC\\Preview\\Font',
    12 => 'OC\\Preview\\MP3',
    13 => 'OC\\Preview\\Movie',
    14 => 'OC\\Preview\\MKV',
    15 => 'OC\\Preview\\MP4',
    16 => 'OC\\Preview\\AVI',
  ),
);

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

I did not see any relevant apach logs

Appreciate your help!

I think this is a bug in last NC. Every new files and dirs have rwX perm. I have the same issue with 21.0.5.

1 Like

Thanks for working this @Thom1! Hope this gets addressed soon :)!

The problem was actually SELinux policies, that weren’t properly applied on the data folder, see this thread.

Thanks to @tflidd for helping find the solution!