0

I accidentally copied my entire disk with rsync -a / ... to my backup server. When trying to delete this backup with sudo rm -rf backup_dir I get a permission denied error on some sub directories of backup_dir/run, backup_dir/sys as well as on some files in docker volumes.
When trying to change the ownership of the files with sudo chmod -R user:user backup_dir, I get the same error. Also changing the file permissions with chmod -R 00775` does not work.

The backup_dir is mounted as cifs like this:
//backup_server/backup on /mnt/backup type cifs (rw,relatime,vers=2.0,cache=strict,username=user,uid=0,noforceuid,gid=0,noforcegid,addr=xxx.xxx.xxx.xxx,file_mode=0755,dir_mode=0755,soft,nounix,mapposix,rsize=65536,wsize=65536,bsize=1048576,echo_interval=60,actimeo=1,closetimeo=1,user=username).

I also tried mounting the backup_dir with sshfs: user@backup_server:/backup on /mnt/backup type fuse.sshfs (rw,nosuid,nodev,relatime,user_id=0,group_id=0) but I get the same permission denied errors.

For example backup_dir/sys/power is an empty directory which I cannot not delete. It has the following attributes: drwxr-xr-x 2 root root 0 2023-12-22 13:31 power.
Changing the ownership of the directory with sudo chown user:user power does not return an error but also has no effect (root stays the owner).

I think this is an issue with extended file permissions (e.g sticky bit). However I cannot list them since lsattr returns a Operation not supported While reading flags on ./file error.

How can I delete those files?

3
  • 1
    Try logging in directly to the server (ex. ssh) and remove the files from there, or see what ls, lsattr, mount say then
    – Xen2050
    Commented Dec 25, 2023 at 4:33
  • That does not work because I only have very limited shell.
    – Meinrad
    Commented Dec 25, 2023 at 21:38
  • I didn't think just viewing mount or /proc/mounts was usually locked down, but anything's possible. Asking the sysadmin should always work, as a last resort
    – Xen2050
    Commented Dec 26, 2023 at 10:29

1 Answer 1

0

You could try to become root with sudo su and then taking ownership with chown -R your_username:your_group backup_dir

The -R flag makes the operation recursive, applying changes to all files and subdirectories.

4
  • When doing that, I get the same permission denied error.
    – Meinrad
    Commented Dec 24, 2023 at 10:06
  • Is the filesystem maybe mounted with restrictions? Read only or immutable. Can you do ls -l for one file and provide the output
    – Turdie
    Commented Dec 24, 2023 at 10:16
  • It is mounted by cifs (samba). I'm currently trying to mount it with a different method.
    – Meinrad
    Commented Dec 24, 2023 at 10:52
  • I tried mounting the backup_dir with cifs and sshfs. I amended the quest with the information.
    – Meinrad
    Commented Dec 24, 2023 at 11:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .