How to “chroot” a terminal inside a DMG

command linedmgterminal

I'm doing security research and for that purpose I use an SHA-2 encrypted DMG to store the tools and files I work with (containing confidential client info), to protect them from forensic examination of my hard drive.

Thinking further, I'd like to know how (if possible) I could open a shell environment inside this mounted DMG, so my .bash_history, .ssh/config and keys and an ./sbin/ binaries folder are available from a shell but only when the DMG is mounted to protect the info they contain. I also hope to make it portable from mac to mac, with my tool and my key, on any mac on which I open the DMG.

Any idea on how to do that?

Best Answer

Indeed what I wanted to do is over complicated. A VM is a better option.