I have a file with following permission:

-rwSr-s---. 1 1634630331 1818884080 118784 Jun 29 1970 DailyUpdateClass.class

If I try to delete this file with root login, I get error.

rm: cannot remove ‘model/DailyUpdateClass.class’: Operation not permitted

I cannot change ownership nor I can do anythig else.

I posted it on StackOverflow and tried few things but no help so far.

I was recommended that I should try this on Unix Stack Exchange so requesting your assistance.

  • What is the output of ls -A in the directory containing the file? Aug 11, 2014 at 10:19
  • 1
    In stack overflow you mention gvfs, how is the directory mounted. It may be that you don't have permission on the remote machine. If so having root access locally will not help. Aug 11, 2014 at 10:29
  • 1
    What does lsattr model/DailyUpdateClass.class show? Where exactly is this file located? Please add the output of the mount command to your post. Aug 11, 2014 at 10:42
  • @richrd ls -A only gives file name. Even though in Red. Using Fedora 20.
    – Srini
    Aug 14, 2014 at 8:53
  • @garethTheRed Thanks. lsattr output is -u-Diad--j------ DailyUpdateClass.class I dont kow what it means.
    – Srini
    Aug 14, 2014 at 8:54

2 Answers 2


A number of possibilities:

  • the trailing dot in the file permissions line -rwSr-s---. indicate extended permissions, either SE Linux (confirm with ls -lZ) or ACL style permissions (confirm with getfacl ) which may block root overrides.
  • the file has been made immutable with chattr ; confirm the file system attributes with lsattr
  • The file is on a NFS filesystem that is exported with the root_squash option which re-maps the remote root user to an unprivileged account. Run the rm command as the actual file owner instead e.g. sudo -u <file_owner> rm filename
  • the file is on read-only file-system, confirm with the mount command or /proc/mounts
  • IIRC you can't remove the special device entries that represent kernel settings such as files on the proc and sysfs file systems, is that the case?
  • Strictly speaking, sudo’ing to a user who has write permission on the directory might be more useful than sudo’ing to the owner of the file. Aug 11, 2014 at 17:10
  • Thanks @HBruijn. ls -lZ Gives following output -rwSr-s---. tuser tgroup system_u:object_r:file_t:s0 DailyUpdateClass.class lsattr gives following output -u-Diad--j------ DailyUpdateClass.class I am unfamiliar with both of them. It is not NFS. It is my laptop hard disk. File System is not readonly. I can create folder and other files in same directory.
    – Srini
    Aug 14, 2014 at 8:52
  • @garethTheRed's answer has explained your output and the resolution; chattr -ia DailyUpdateClass.class should remove the immutable flag and allow you to delete the file.
    – HBruijn
    Aug 17, 2014 at 8:33

Your file has the immutable extended attribute set, which is why you can't delete it.

lsattr returns the extended attributes on the file:

$ lsattr model/DailyUpdateClass.class
-u-Diad--j------ DailyUpdateClass.class

You will need to decipher all of the letters (-u-Diad--j)

The man page for lsattr will tell you to look at the man page for chattr for a description of the extended attributes. I've listed the relevant ones here:

When a file with the u attribute set is deleted, its contents are saved. This allows the user to ask for its undeletion. Note: please make sure to read the bugs and limitations section at the end of this document.

When a directory with the D attribute set is modified, the changes are written synchronously on the disk; this is equivalent to the dirsync mount option applied to a subset of the files.

The D one is slightly worrying - it apparently is only used on directories, but you have a file.

A file with the i attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file and no data can be written to the file. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

A file with the a attribute set can only be open in append mode for writing. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

A file with the d attribute set is not candidate for backup when the dump(8) program is run.

A file with the j attribute has all of its data written to the ext3 or ext4 journal before being written to the file itself, if the filesystem is mounted with the data=ordered or data=writeback options. When the filesystem is mounted with the data=journal option all file data is already journalled and this attribute has no effect. Only the superuser or a process possessing the CAP_SYS_RESOURCE capability can set or clear this attribute.

To fix these, use chattr. For example, to remove the immutable and append attributes:

# chattr -ia model/DailyUpdateClass.class

You must log in to answer this question.

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