1

I am trying to remove directories with files and getting a permission denied error on Ubuntu 22.04.1.

I've changed permissions to 777 for the directory and the parent directory but I still get the error.

Screenshot of the error

$ sudo rm *.* 
rm: cannot remove 'Real Economy v1.5.1-4267-1-5-1-1588544476': Permission denied
rm: cannot remove 'Witcher 3 input.settings file backup for 1.32-5844-1-32-1626358844': Permission denied

Additional

The directory containing the directories/files I'm trying to delete is a default download destination for Brave Browser and also Firefox. It's on the system disk (SSD). The browsers also won't allow me to change the download destination, which is weird. The files were downloaded here and are intended for Windows (mods for Witcher 3).

The other weird thing is that these are extracted archives (7-zip files, etc).
I CAN delete the original archive file, but once I extract it, I CAN'T remove the extracted directories/files.

Artur Meinild
  • 26,018
Artillery
  • 356

2 Answers2

12

Besides file permissions there are (at least) 5 more things that can influence your ability to delete things:

  • Extended acl's (man getfacl)
  • File attributes (man chattr)
  • Fileystem mount options (man mount)
  • Linux security modules (man apparmor)
  • And for remote filesystems (nfs, cifs, ...) all of the above again, but on the remote side. Plus remote-mount specific limitations (e.g. cifs servers refusing deletes from clients)
  • The directory is a default download destination for Brave Browser and also Firefox. Its on the system disk (ssd). The browsers also wont allow me to change the download destination, which is weird. The files were downloaded here and are formatted for windows,(mods for witcher3) – Artillery Nov 07 '22 at 23:19
  • Tried looking at file attributes but there's nothing there – Artillery Nov 08 '22 at 00:09
  • lsattr -R * lsattr: Function not implemented While reading flags on content/content0 (there's hundreds of lines like this for each file) – Artillery Nov 08 '22 at 00:10
  • Also tried $ chattr -i -R . chattr: Function not implemented while reading flags on Real Economy v1.5.1-4267-1-5-1-1588544476 chattr: Function not implemented while reading flags on Witcher 3 input.settings file backup for 1.32-5844-1-32-1626358844 – Artillery Nov 08 '22 at 00:32
  • Normally the root user has CAP_DAC_OVERRIDE, which means any access control at VFS level (file modes, ACL etc.) shouldn't matter. Your other arguments are valid. – iBug Nov 08 '22 at 11:33
  • For NFS, there's also a server option where client superuser is translated to nobody. – Barmar Nov 08 '22 at 14:46
2

I figured it out. It's because it's directories I'm trying to delete. For anybody else who gets this problem, the command is

rm -rf 'directory name'

That removes the directory and all subdirectories and files. Thanks to everyone for their input.

Artillery
  • 356