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

next in thread | previous in thread | raw e-mail | index | archive | help
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



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