This page is a wiki. Please login or create an account to begin editing.


5 posts / 0 new
Last post
OpenSourceMac's picture
Offline
Joined: 2019 Jan 21
IRON CLAD File Protection...

After using Linux, if missed not having the chattr command that lets you make files 'Immutable' in OSX. But low and behold, it turns-out that OSX has one at least as good.

Turns out if you alias a Read-Only Locked/Hidden Folder that its contents cannot be deleted (even by root) until that lock is removed. Also, the lock doesn't show up in the alias, and simply returns the "You lack sufficient privileges to complete the operation" error - even when doing "sudo rm -fR" from terminal. Now if someone has a way to show hidden files and unlock the folder (much like reversing chattr in Linux), then the files becomes negotiable again, but it is much more complicated. And for added protection, it can be placed within a 2nd locked folder, which if a seldom-used system folder, will confound the heck out of anyone trying to do it, unless they really know what's going on with it: much less someone accidently deleting something.

Just a cool tool if needed.

Comments

cbone's picture
Offline
Joined: 2011 Sep 17

This would be a good one to get a video how-to on.. just not on someplace too open like YT; you want to keep the mystery of such cool tricks Wink

OpenSourceMac's picture
Offline
Joined: 2019 Jan 21

The only tricky part is finding an app to make the file hidden but this one has served me for nearly 15 years https://macdownload.informer.com/juhos-x/. Just make sure you make it Hidden and Read-Only (Read Only should be done to contents as well) before you lock it (have the file info pane out for both procedures).

One advantage of OSX over Linux, is that while files are hierarchal also in Linux, the files inside an 'immutable' folder are not always immutable themselves - depends on the Distro and File Manager. You sometimes have to do it to each file inside as well.

But with HFS, if the folder is Locked, the contents cannot be changed - even by Root.

cbone's picture
Offline
Joined: 2011 Sep 17

Wow OSM, this is real Mac-magic! Laughing out loud

adespoton's picture
Offline
Joined: 2015 Feb 15

On modern macOS (10.11 and later IIRC), you can also route this technique through a SIP-protected folder, which requires you to manually reboot and disable SIP in order to delete it. Of course, you also have to disable SIP to set this up in the first place, so it's not something you can easily deploy via a dmg, unlike the basic technique. Also, if you haven't used it, it's worth getting to know the macOS xattr command, which also lets you set a lot of extended attributes on files. You can also use external definition files with xattr to manipulate various file system-related attributes of a file path, from readability to named forks.