Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Hi I am facing an issue while deleting an .iso file from Linux x86_64 GNU/Linux.

Here are the permissions for the file:

    # ls -lrt
    -rwxrwxr-x 1 dev devgrp 2687934464 Apr 12 14:13 FileName.iso*

Here is the error I am getting:

    # rm -f FilsName.iso
    rm: cannot remove `FileName.iso': Permission denied

How to resolve this Permission denied error? I am logged in as root user.


EDIT

$ lsattr
lsattr: Inappropriate ioctl for device While reading flags on ./FileName.02.md5
lsattr: Inappropriate ioctl for device While reading flags on ./FileName.02.iso
lsattr: Inappropriate ioctl for device While reading flags on ./FileName.03.md5
lsattr: Inappropriate ioctl for device While reading flags on ./FileName.03.iso
lsattr: Inappropriate ioctl for device While reading flags on ./FileName.04.iso

Strange issuse for me I can delete/move other files except FileName.04.iso.

share|improve this question
    
I was going to add as answer that the .iso file might be mounted in loopback mode. But I tried and you can actually rm the file from underneath an existing loopback mount. –  Anthon Apr 16 '13 at 8:21
    
Could you please clarify more? Thanks –  meMangesh Apr 16 '13 at 10:10
    
Your touch test, assuming test is next to FilsName.iso is taking care of Hauke's test nr 1. That does not apply. –  Anthon Apr 16 '13 at 10:14
    
My comment was based on the fact that I thought that if you mount the filesystem in the .iso file (which most likely is a file with a cdrom image) that you cannot delete that file. But that is wrong. –  Anthon Apr 16 '13 at 10:16
    
@Anthon You cannot delete the file, indeed. You can delete a directory entry. But as long as the file is opened the reference count in the inode is not set to 0 (which causes the real deletion of the file). This can lead to the strange situation that df tells you that a file system is nearly full but you cannot find the files which sum up to that capacity. Doing this with a kernel module is probably even more fun as to my knowledge you don't have any chance to determine that from userspace. The other ones can still be seen (and accessed / rescued) via /proc/*/fd –  Hauke Laging Apr 16 '13 at 10:23

1 Answer 1

Usually this is not about the access rights of the file but about those of its parent directory (because deleting the file means deleting the entry in the file list; for this the directory has to be written). You need write access to the parent.

Under normal conditions this would not affect root. root can be blocked by

  1. read-only mounts
  2. special file system attributes (immutable flag, see lsattr)
  3. Edit: file system errors - run fsck
  4. kernel security features (AppArmor, SELinux)

I would check in this order.

share|improve this answer
    
Thanks Hauke for answer. for further clarification I can touch test and I can easily delete rm -f test. It indicates that the directory has write access. But don't know why am unable to delete .iso file in the same directory? –  meMangesh Apr 16 '13 at 10:09
1  
@Check_MK Why don't you do what I told you? Quoting myself: "see lsattr". –  Hauke Laging Apr 16 '13 at 10:15
    
ahh by mistake i entered -r option in rm command. I updated the question accordingly. It still not permitted for rm -f file –  meMangesh Apr 16 '13 at 10:24
1  
@Check_MK Oh that's pretty cool. Who would ever need strace on a server... So what about installing it? –  Hauke Laging Apr 16 '13 at 10:39
1  
@Check_MK Let me sum up: You don't know what snapshots are and rather happily destroy all your data than ask. –  Hauke Laging Apr 16 '13 at 11:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.