1

I know that I can create a password protected dmg file with more folders in it. But I want to know if there's a way through which I can prevent any action on the dmg file itself. Because right now, if anyone wants to delete the dmg file - which contains a whole lot of backup - they can do so without having to enter the password. I want to have to enter a password to rename, delete, move the dmg file without it having opened.

2

To keep the .dmg file from being deleted without explicit permission, you need to set the ACL permissions for the file to not be deleted. In Terminal use, e.g.:

sudo chmod +a "everyone deny delete" foobar.dmg

Once set, if you try to rename, delete, or move the .dmg file, e.g. in Finder, you'll have to enter Administrator credentials, or in Terminal use sudo, which requires the same level of credentials too, to do the same.


In Terminal, have a look at the manual page for chmod, e.g., type man chmod and press Enter, or just type chmod and right-click on it selecting, Open man Page.

  • In general, I'd read then entire man page however, the section titled
    ACL MANIPULATION OPTIONS is the relevant one to focus on.

To see what ACL permissions are set on a file/folder, use, e.g.:

$ ls -le foobar.dmg
-rw-r--r--@ 1 me  staff  100020736 Dec  7 09:21 foobar.dmg
0: group:everyone deny delete
$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .