CRYPTMOUNT(8)
π CRYPTMOUNT(8) π
okay bestie, welcome to cryptmount β she lives in the User commands section of the manual, and she is literally the moment. buckle up π
β¨ NAME β¨
cryptmount β mount/unmount/configure an encrypted filesystem
πΈ SYNOPSIS πΈ
cryptmount TARGET [TARGET ...]
cryptmount --unmount TARGET [TARGET ...]
cryptmount --change-password TARGET
cryptmount --generate-key SIZE TARGET
cryptmount --swapon TARGET
cryptmount --swapoff TARGET
π DESCRIPTION π
So cryptmount lets you mount or unmount an encrypted filesystem without needing superuser privileges, and she also helps the superuser out when they're creating brand-new encrypted filesystems. iconic behaviour, truly. π«Ά
Here's the vibe: the system administrator does the initial configuration of the filesystem once, and after that the user only has to hand over the decryption password for that filing system. cryptmount then automatically configures the device-mapper and loopback targets before mounting the filesystem. she does all the boring bits for you. π
ngl, cryptmount was written in response to differences between the newer device-mapper infrastructure of the linux-2.6 kernel series and the older cryptoloop infrastructure. the old one let ordinary users reach encrypted filesystems directly through mount(8), and the new oneβ¦ did not. so she stepped in. π§
β¨ OPTIONS β¨
-a,--allβ act on all available targets. like, for mounting every single target at once. the "select all" of cryptomounting π-m,--mountβ mount the specified target, configuring any device-mapper or loopback devices that are required. the user is going to get asked to supply a password to unlock the decryption key for the filesystem. π-u,--unmountβ unmount the specified target, and deconfigure any underlying device-mapper or loopback devices. no password needed bestie. that said, it will fail if the filesystem is in use, or if a non-root user tries to unmount a filesystem that was mounted by a different user. π-S,--statusβ gives you info on whether the specified target is currently mounted or not. a little vibe check for your filesystem π-l,--listβ lists all available targets, including basic information about the filesystem and mount point of each. window shopping β¨-c,--change-passwordβ change the password that protects the decryption key for a given filesystem. glow-up for your password π-g,--generate-keysize β set up a decryption key for a new filesystem. size gives the length of the key in bytes.-e,--reuse-keyexisting-target β set up a decryption key for a new filesystem using an existing key from another filesystem. the use case: translating between different file-formats for storing a single key. this option is only available to the superuser. π-f,--config-fdnum β read configuration information about targets from file-descriptor num instead of the default configuration file. this option is only available to the superuser.-w,--passwd-fdnum β read passwords from file-descriptor num instead of from the terminal. this is the move when you're usingcryptmountinside scripts or GUI wrappers. each password is read once only here β in contrast to terminal-based operation, where new passwords would be requested twice for verification. π-p,--prepareβ prepare all the device-mapper and loopback devices needed to access a target, but do not mount. the intention here is to allow the superuser to install a filesystem on an encrypted device.-r,--releaseβ releases all device-mapper and loopback devices associated with a particular target. this option is only available to the superuser.-s,--swaponβ enable the specified target for paging and swapping. this option is only available to the superuser.-x,--swapoffβ disable the specified target for paging and swapping. this option is only available to the superuser.-k,--key-managersβ list all the available formats for protecting the filesystem access keys. π-B,--system-bootβ setup all targets which have declared abootactionparameter. typically you'd use this to automatically mount encrypted filesystems, or to setup encrypted swap partitions, on system startup. this option is only available to the superuser.-Q,--system-shutdownβ close-down all targets which have declared abootactionparameter. essentially the opposite of the--system-bootoption. π-n,--safetynetβ attempts to close-down any mounted targets that should normally have been shutdown with--unmountor--swapoff. this option is only available to the superuser, and it's intended exclusively for use during shutdown/reboot of the operating system. π¨-v,--versionβ show the version-number of the installed program.
π RETURN CODES π
cryptmount returns zero on success. a non-zero value means something went sideways, and here's the tea:
1β unrecognized command-line option;2β unrecognized filesystem target name;3β failed to execute helper program;100β insufficient privilege;101β security failure in installation.
π¦ EXAMPLE USAGE π¦
So you wanna create a new encrypted filesystem managed by cryptmount? you can use the supplied cryptmount-setup program β the superuser can use it to interactively configure a basic setup. easy mode. π
Alternatively, a manual setup allows more control over configuration settings. before doing that though, you should make sure kernel support for /dev/loop and /dev/mapper is available, e.g. via
modprobe -a loop dm-crypt
now, suppose we wish to setup a new encrypted filesystem that will have a target-name of "opaque". if we have a free disk partition available β say /dev/sdb63 β then we can use this directly to store the encrypted filesystem. alternatively, if we want to store the encrypted filesystem within an ordinary file, we need to create space using a recipe such as:
dd if=/dev/zero of=/home/opaque.fs bs=1M count=512
and then replace all occurrences of '/dev/sdb63' in the following with '/home/opaque.fs'. (/dev/urandom can be used in place of /dev/zero, debatably for extra security, but it is rather slower. β³)
First, we need to add an entry in /etc/cryptmount/cmtab, which describes the encryption that will be used to protect the filesystem itself and the access key, as follows:
opaque {
dev=/dev/sdb63 dir=/home/crypt
fstype=ext2 mountoptions=defaults cipher=twofish
keyfile=/etc/cryptmount/opaque.key
keyformat=builtin
}
here, we will be using the "twofish" algorithm to encrypt the filesystem itself, with the built-in key-manager being used to protect the decryption key (which is stored in /etc/cryptmount/opaque.key). π
in order to generate a secret decryption key (in /etc/cryptmount/opaque.key) that will be used to encrypt the filesystem itself, we can execute, as root:
cryptmount --generate-key 32 opaque
this will generate a 32-byte (256-bit) key, which is known to be supported by the Twofish cipher algorithm, and store it in encrypted form after asking the system administrator for a password.
if we now execute, as root:
cryptmount --prepare opaque
we will then be asked for the password that we used when setting up /etc/cryptmount/opaque.key, which will enable cryptmount to setup a device-mapper target (/dev/disk/by-id/dm-name-opaque).
heads up bestie: if you receive an error message of the formdevice-mapper ioctl cmd 9 failed: Invalid argument, this may mean that you have chosen a key-size that isn't supported by your chosen cipher algorithm. you can get some information about suitable key-sizes by checking the output frommore /proc/crypto, and looking at themin keysizeandmax keysizefields. π
we can now use standard tools to create the actual filesystem on /dev/disk/by-id/dm-name-opaque:
mke2fs /dev/disk/by-id/dm-name-opaque
(it may be advisable, after the filesystem is first mounted, to check that the permissions of the top-level directory created by mke2fs are appropriate for your needs.)
after executing
cryptmount --release opaque
mkdir /home/crypt
the encrypted filesystem is ready for use. π ordinary users can mount it by typing
cryptmount -m opaque
or
cryptmount opaque
and unmount it using
cryptmount -u opaque
cryptmount keeps a record of which user mounted each filesystem, in order to provide a locking mechanism that ensures only the same user (or root) can unmount it. that's main character energy, honestly. π
π PASSWORD CHANGING π
after a filesystem has been in use for a while, you might want to change the access password. for an example target called "opaque", this can be performed by executing:
cryptmount --change-password opaque
after successfully supplying the old password, you can then choose a new password, which will be used to re-encrypt the access key for the filesystem. (the filesystem itself is not altered or re-encrypted. no cap, just the key gets a new fit.) π
π§ LUKS ENCRYPTED FILESYSTEMS π§
cryptmount can be used to provide easy access to encrypted filesystems that are compatible with the Linux Unified Key Setup (LUKS) capabilities of the cryptsetup application.
in order to access an existing LUKS partition, an entry needs to be created within /etc/cryptmount/cmtab. for example, if the hard-disk partition /dev/sdb62 is used to contain a LUKS encrypted ext3 filesystem, an entry of the form:
LUKS {
keyformat=luks
dev=/dev/sdb62 keyfile=/dev/sdb62
dir=/home/luks-dir fstype=ext3
}
would allow this to be mounted via cryptmount beneath /home/luks-dir by executing
cryptmount LUKS
cryptmount will also allow any user that knows one of the access-passwords to change their password via
cryptmount --change-password LUKS
cryptmount also provides basic support for creating new LUKS encrypted filesystems, which can be placed within ordinary files as well as disk partitions, via the --generate-key recipe shown above. However, to exploit the full range of functionality within LUKS β such as for adding multiple passwords β one needs to use cryptsetup.
β οΈ it is strongly recommended that you do not attempt to use LUKS support in combination with cryptmount's features for storing multiple encrypted filesystems within a single disk partition or an ordinary file. this is because of assumptions within the cryptsetup-luks design that the LUKS key-material is always stored at the beginning of the disk partition. don't do it bestie, it's giving chaos π
π FILES π
/etc/cryptmount/cmtab β main configuration file
/run/cryptmount.status β record of mounted filesystems
π SEE ALSO π
cmtab(5), cryptmount-setup(8), cryptsetup(8), mount(8)
π BUGS π
the author would be grateful for any constructive suggestions and bug-reports, via https://github.com/rwpenney/cryptmount/issues π«Ά
π COPYRIGHT NOTICE π
okay bestie, legal era, but make it cute π
cryptmount is (C)Copyright 2005-2026, RW Penney, and it comes to you with NO WARRANTY β like, none, zero, nada, you are on your own in the best way possible π
The licencing terms are all spelled out in the file "COPYING" inside the cryptmount source distribution. so if you wanna know the fine print, that's where the fine print lives, go read it, it's giving very legit πβ¨
and that's the whole page, bestie!! you made it to the end, iconic behaviour honestly ππ
this was cryptmount 6.4.0, dated 2024-07-21 β go mount something, stay encrypted, stay slay π¦πβ¨
π¦ where this page comes from
- ubuntu stonking: cryptmount 6.4.0-2 Β· GPL-2.0-or-later
- Copyright 2005-2025, RW Penney
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms