Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jan 2017 16:30:57 -0800
From:      Balaji Palaniswami <heisenbug.bala@gmail.com>
To:        Ian Lepore <ian@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: How to delete read only files.
Message-ID:  <CAB0r=atCa_sGvkoojKRBMmAumrE2oQeUpZ2D0Ax8MhBwLLrYug@mail.gmail.com>
In-Reply-To: <1485821962.3017.32.camel@freebsd.org>
References:  <CAB0r=audiCeUGDiCu9y_d=O7p86wXRnqN1GGXrSs%2B6UC%2Bxe=OA@mail.gmail.com> <1485821962.3017.32.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jan 30, 2017 at 4:19 PM, Ian Lepore <ian@freebsd.org> wrote:

> On Mon, 2017-01-30 at 16:12 -0800, Balaji Palaniswami wrote:
> > Hi,
> >
> > I am trying to delete read only files.
> >
> > # pwd
> > /usr/home/bp/nfsroot/lib
> > # whoami
> > root
> > # ls
> > libc.so.7       libcrypt.so.5   libthr.so.3
> > # ls -ltr
> > total 3264
> > -r--r--r--  1 root  wheel  1460592 Jan 29 12:07 libc.so.7
> > -r--r--r--  1 root  wheel    51640 Jan 29 12:07 libcrypt.so.5
> > -r--r--r--  1 root  wheel   109568 Jan 29 12:08 libthr.so.3
> > # rm -rf libc.so.7
> > rm: libc.so.7: Operation not permitted
> >
> > # chmod 777 libc.so.7
> > chmod: libc.so.7: Operation not permitted
> >
> > Please suggest me some ways to delete these files.
> >
> > Thanks,
> > Balaji
>
> Those libraries typically have the 'schg' flag set on them, as do some
> others in the tree.  If you need to wipe everything under nfsroot, the
> typical incantation is
>
>   rm -rf nfsroot/ ; chflags -R noschg nfsroot/; rm -rf nfsroot/
>
> that deletes everything it can first, then changes the flags on what's
> left, then deletes them too.  (Doing the noschg first requires
> examining/changing 145,000 files.)
>
> -- Ian
>

It wiped off all files under nfsroot. Thank you so much for your quick help.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAB0r=atCa_sGvkoojKRBMmAumrE2oQeUpZ2D0Ax8MhBwLLrYug>