From owner-freebsd-hackers@freebsd.org Tue Jan 31 00:19:29 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF6BDCC704F for ; Tue, 31 Jan 2017 00:19:29 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8C10912E1 for ; Tue, 31 Jan 2017 00:19:29 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: ed3ab5fd-e74a-11e6-95b5-6dfd7dbb0ee5 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.eu.mailhop.org (Halon) with ESMTPSA id ed3ab5fd-e74a-11e6-95b5-6dfd7dbb0ee5; Tue, 31 Jan 2017 00:19:28 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v0V0JMvx014675; Mon, 30 Jan 2017 17:19:22 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1485821962.3017.32.camel@freebsd.org> Subject: Re: How to delete read only files. From: Ian Lepore To: Balaji Palaniswami , freebsd-hackers@freebsd.org Date: Mon, 30 Jan 2017 17:19:22 -0700 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2017 00:19:30 -0000 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