Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I got into a weird situation. I got a 1Tb portable HD filled with some contents. It was used in Windows and as always packed with virus. I tried deleting some folders as root. But the following error returned

rm: cannot remove `RECYCLER/S-1-5-21-1659004503-1644491937-725345543-1003/Dc39.pptx': Operation not permitted
rm: cannot remove `RECYCLER/S-1-5-21-1659004503-1644491937-725345543-1003/Dc58.docx': Operation not permitted
rm: cannot remove `RECYCLER/S-1-5-21-1659004503-1644491937-725345543-1003/Dc17.JPG': Operation not permitted

ls -l returned

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf898cc8b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1      121602   976760536    7  HPFS/NTFS

total 12
drwxrwxrwx 1 user user 12288 Dec 11 21:13 S-1-5-21-1659004503-1644491937-725345543-1003
share|improve this question
What is the drive mounted as? – Hello71 Dec 29 '11 at 16:06
Its automounted in /media as with NTFS as the FS – user61954 Dec 29 '11 at 16:21
Extended attributes or ACLs on the files? – Daniel Beck Dec 29 '11 at 16:30
Is it possible that your drive is mounted as read-only? Executing mount provides this information. – Dennis Dec 29 '11 at 16:30
up vote 2 down vote accepted

The directory RECYCLER/S-1-5-21-1659004503-1644491937-725345543-1003 is presumably read-only. Run chmod -R u+w RECYCLER to set write permission on directories, then rm -rf RECYCLER.

If this is through a FUSE filesystem, it's possible that only the user who mounted the filesystem has write permission on it. In that case, run su user rm -rf RECYCLER.

share|improve this answer
When I run chmod -R u+w RECYCLER it gives the operation not permitted. I tried even running chown command – user61954 Dec 29 '11 at 16:23
@user61954 NTFS is usually provided through FUSE (via ntfs-3g) these days, so try su user … (second paragraph of my answer). – Gilles Dec 29 '11 at 16:37
Installed ntfs-3g and now it works fine :) – user61954 Dec 30 '11 at 2:48

This is due to an immutable attribute set for the files. If your filesystem driver allows it, run the command below before removing it.

chattr -i RECYCLER/S-1-5-21-1659004503-1644491937-725345543-1003/*
rm -f RECYCLER/S-1-5-21-1659004503-1644491937-725345543-1003/*
share|improve this answer

On debian you can use the fsck.ntfs command.

I think the Package is called NTFSProgs.

share|improve this answer

Looks like some filesystem issues. Try chkdsk /F [Harddrive]: on a windows PC.


chkdsk /F E:

share|improve this answer
Sorry, I dont have windows – user61954 Dec 29 '11 at 16:22
If it's not going to be used on Windows again, I suggest you backup the useful files and reformat it with ext4 or other Linux-native filesystems. – netvope Dec 30 '11 at 0:46
The probelem is that its owner uses Windows :D – user61954 Dec 30 '11 at 2:28

I had this problem on my Note 3 (Android device) with some files in a folder on the external SD card. rm produced "operation not permitted" and lsattr produced "inappropriate ioctl for device".

The fix for me was to take the SD card out of the phone and put it into a PC to delete the files. Worked like a charm. I know that's not exactly a "linux" solution but it's the only thing that worked. Hopefully this will help someone else.

share|improve this answer
This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. – warren Jul 21 '14 at 19:41
@warren: What question does this not answer? The original question does not really ask a question. Implicitly, it asks, "How do I remove contents from a Windows disk?" Dubious is (somewhat anecdotally) answering, "Put the disk back on a Windows system and do it there." It's no less of an answer than Daniel's first answer. OK, yes, user61954 says that [s]he doesn't have Windows; hence Dubious's disclaimer that he hopes this will help someone else. – Scott Jul 21 '14 at 19:52
@Scott - the question is about external hard drives and linux: Dubious' answer is about an SD card from an Android device that needed to be deleted using Windows. The answer has nothing to do with the question, and is barely tangentially similar. – warren Jul 21 '14 at 22:32

You must log in to answer this question.

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