Shell script: Opens LUKS Partition and Sets Up a Mapping [ Mounting Encrypted Partition ]

Posted on in Categories Security last updated December 4, 2011

Linux comes with the cryptsetup command. It is used to setup dm-crypt (transparent disk encryption subsystem in Linux kernel) managed device-mapper mappings. This shell script can be used to mount dm-crypt based partitions with passphrase:

This script is stored on our nas server. All backups are on RAID-6 disks are encrypted. The nas server is online 24×7. After rebooting the server you need to run this script to mount the dm-crypt based partition. A sample session is as follows:
$ ssh [email protected]
$ sudo /usr/local/sbin/mount.crypt

Sample outputs:

Verify disk space and newly mounted partition:
$ df -H
Sample outputs:

1 comment

Leave a Comment