Block opening of DMG files by non-admin user I set up Parental Control for a user but said user is still able to download and install additional software from DMG files (among other they downloaded TOR browser which bypasses parental control)..

I would block downloading in parental controls entirely however this would be a problem as certain downloaded files from the web are needed by the non-admin user.

-> Is there a solution to block the opening/downloading of DMG files by the non-admin user (maybe installers more broadly)?
Here is a solution that may work for you.

Paste this following AppleScript code into a new ScriptEditor.app document then save it as a .scpt file "AutoEjectFolderAction.scpt" to your /Users/your user name/Library/Workflows/Applications/Folder Actions/ ...folder

on adding folder items to theFolder after receiving theNewItems
    -- Add Names of Any USB, Flash Drive, or Disk Image to allow to be mounted
    set allowedDisks to {"Time Machine Backups", "Parallels Desktop 13.2.0 (43213)"} -- examples to be allowed
    tell application "Finder"
        set ejectableDisks to disks whose ejectable is true and local volume is true and name is not in allowedDisks
        eject ejectableDisks
    end tell
end adding folder items to


That new .scpt file will now be used as a folder action that we will attach to the folder... /Volumes









Now every time A new disk image gets mounted, it will trigger the folder action which will run the script that will automatically eject it.