I find myself in a strange situation where a script wrote files with the following permissions:

-r-------- 1 user1 user1 file1 Dec 24 14:53
-r-------- 1 user1 user1 file2 Dec 24 14:54
-r-------- 1 user1 user1 file3 Dec 24 14:55

How do I remove these files? I can't change the permissions of the files with chmod [neither with 'user1' nor as sudo/root].

[If it makes any difference, I am running ubuntu]

  • Can you change the owner using chown username file? Dec 24, 2013 at 14:12
  • @Pazis No, I don't have permissions for that! It's a recursive problem :(
    – Dhara
    Dec 24, 2013 at 14:16
  • I cannot see the problem: I can easily chmod my files, even when their permissions are just 400. And I can delete them. Your problem is elsewhere (disk mount, perhaps?). Dec 24, 2013 at 16:11
  • @MariusMatutiae - In your computer you will be the owner of the files so you won't find any problem in your system. Dec 24, 2013 at 17:01
  • 1
    Right. Are you telling me you are trying to erase someone else's files? Dec 24, 2013 at 17:01

2 Answers 2


If you can't take ownership of them with the command:
sudo chown "${USER}" filename

And you can't delete them with the command:
sudo rm filename

Then you need to check if you can write at all to the partition.

If you can change other files on the partition, but not those files, then you probably have one of the following:

  • Files with the immutable flag set
  • Filesystem errors
  • Read-only overlay-fs
  • Some weird corrupted ACL

or a kernel thread or a root-kit may be blocking writes to the files.


Removing a file means changing the directory containing them. The file's permissions (and its ownership, for that matter) are inconsequential.

So, if you have write permissions to the containing directory, a simple rm should work.

If you do not, you will have to chmod +w . first.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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