People are generally OK with the idea of having various important documents stored on their Mac, and are quite happy with existing protection built into macOS, including using FileVault to encrypt drives and even just having a password to access the user account in the first place.
However, users may feel some items are too important to not apply some extra level of security. This can range from needing to secure work-related folders that need to be sent to another user, to adding extra protection to birth certificate and passport scans, to keeping embarrassing childhood photos out of view from other members of the family who may sometimes borrow the same user account.
A solution to this is to use Disk Utility to create a disk image, one that is password protected and encrypted, from a folder.
Creating the Image
Open up Disk Utility, which can be found in the Applications folder, under Utilities. Alternately, use the search function in Finder to search “This Mac” for Disk Utility.
In the Disk Utility menu, select File, New Image, then Image from Folder…, or use the keyboard shortcut Shift-Command-N. In the following dialog box, select the folder you wish to protect, and click Open
A new dialog box will appear with a number of options available for creating the disk image. At the top, you can change the name of the disk image to something more appropriate to its contents instead of using the folder name by default, and where you want it to be initially saved.
Under the Image Format dropdown box, select Read/Write to be able to change files held within the image once it is created. If you don’t want any changes made to the files in the folder at all, or new files to be added, select Read-Only.
Under Encryption, select either 128-bit or 256-bit AES encryption. As indicated in the dropdown box, selecting 256-bit is more secure but will be slower to access compared to 128-bit, so select this only if required.
Enter your desired password twice.
Once the settings are entered, click Save, then Done once the application has completed the image.
At the location defined in the settings, you will find a new DMG file with the name entered during the process.
Accessing the Image
Your new secure image is used in a similar way to other images. To access the files within, the image needs to be mounted.
Double click the image to mount it. A dialog box will appear asking for the password, which needs to be filled out followed by clicking OK.
A tickbox below the password entry textbox offers to save the password to the Keychain. Depending on what’s stored, and if anyone else has access to the same Keychain by using the same user account, it is probably not a good idea to tick this box.
Once the right password is entered, the image will mount, and the files will be accessible.
The folder will not need the password again while the image is mounted, but will require it when the image is unmounted.
To unmount, right-click the mounted image and select Eject.
After creating the image, it is tempting to delete the source folder and its contents. Before doing so, it is suggested to make sure the image functions as planned, and if necessary, checking there is a securely-held backup of the files.
The same process can also be used to create other types of disk images, like a read-only image to distribute a set collection of files or an application. To create an image that isn’t secured with a password, simply do not select either of the encryption options.