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
  • 31,035
Artillery
  • 386

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)
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
  • 386