rm: Operation not permitted

Daniel Bye dan at slightlystrange.org
Thu May 8 04:43:28 PDT 2003

On Thu, May 08, 2003 at 01:25:36PM +0200, Antoine Jacoutot wrote:
> Hi !
> I have a ERASE/empty/ directory in /root, and when I want to erase this 
> folder, I get the following error:
> # rm -Rf ERASE/
> rm: ERASE/empty: Operation not permitted
> rm: ERASE/: Directory not empty
> I chmod everything to 777 but still get the same error (as root !).
> Is there any way I can get read of those folders ?


 # ls -lo /root/ERASE

You will probably see that the directory empty has the "schg" flag set.
This tells the kernel not to allow any alterations to flagged object.  To
remove it, you will need to remove the flag -

 # chflags -R noschg ERASE

will do the trick.  You can then remove ERASE and its contents.  

man chflags(1) for more details.


Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: 3D73 AF47 D448 C5CA 88B4 0DCF 849C 1C33 3C48 2CDC
                                              ASCII ribbon campaign ( )
                                         - against HTML, vCards and  X
                                - proprietary attachments in e-mail / \

More information about the freebsd-questions mailing list