Solved Undeletable system files

dnel

New Member


Messages: 2

I unpacked base.txz onto a running FreeBSD system and then went to remove it, however because permissions on some files look like this:
Code:
-r-sr-xr-x  1 root  wheel  26320 Sep 29 02:45 login*
Even root cannot delete these files.

What can I do to forcibly delete them?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,183
Messages: 29,471

Use chflags(8) to remove the schg flag. A lot of files of the base OS are protected this way.

Example:
chflags -R noschg /usr/bin
 

kpa

Beastie's Twin

Reaction score: 1,801
Messages: 6,318

To list the flags on any file, let's say on /sbin/init that is protected from deletion:

ls -lo /sbin/init

Code:
% ls -lo /sbin/init
-r-xr-xr-x  1 root  wheel  schg 1061880 Sep 29 14:23 /sbin/init
 
Top