Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A relatively safe method of deleting trashed locked files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A relatively safe method of deleting trashed locked files
Authored by: EelBait on Aug 24, '06 08:53:14PM

Sort of a corollary to the above comments is how to really protect a file. If you lock a file using the Finder's "get info" window, you are really setting the "uchg" flag and is equivalent to chflags uchg filename. The only way to remove a file such is to first clear the flag, by unchecking the "locked" flag in the Finder, or by chflags nouchg filename in the terminal.

Now, if you REALLY want to protect a file, you set the "schg" flag via chflags schg filename. Once again, the file can only be removed if you first clear the flag. This is the fun part. You can only remove the schg flag while in single-user mode. Not even root can remove this flag.

To do this you need to reboot while holding down "Command-S" until you arrive at the command prompt. Following the instructions you type mount -uw / to make the hard drive writable. Then you "cd" to the location where your file is and type chflags noschg filename. Then you may delete the file.

This is great way to make certain critical files impervious to modification in a hostile network environment.



[ Reply to This | # ]