A set of command-line tools to make it easier to use VeraCrypt for password-protected volumes.
If you decided to use password-protected volumes, this set of tools:
- avoids you from having to find where your encrypted disk is attached (e.g. is it '/dev/sdb1'?) - just pass the disk vendor/model name,
- allows you to quickly mount / unmount volumes without typing passwords - just create small wrapper scripts in your PATH (assuming your hard drive is encrypted...),
- allows you to execute scripts (e.g. backup scripts) on your password-protected volumes,
- avoids unnecessary backups by mounting by default volumes as read-only - pass
-w
to mount as read-write.
The following tools are used:
- VeraCrypt,
lsblk
to lookup disks by vendor name / disk model (installed by default on Ubuntu).
To mount password-protected volumes or encrypted file-containers, use v-mount
:
# Mount a disk as read-write using the disk vendor name and use a default veracrypt mount point
v-mount -p "password" -V "Kingston" -w
# Mount a disk as read-write using the disk model and use a default veracrypt mount point
v-mount -p "password" -M "Samsung T5" -w
# Mount a disk as read-write by specifying the block device and the mount point
v-mount -p "password" -v /dev/sdb1 -m /mnt/data -w
# Mount an encrypted file-container as read-write and specify the mount point
v-mount -p "password" -v volume.tc -m /mnt/data -w
# See more options
v-mount -h
To mount password-protected volumes or encrypted file-containers and browse them, use v-imount
.
Press Ctrl+D when you are done and the volume will be unmounted automatically.
For instance, you can create a wrapper script in your path to quickly mount your
encrypted USB drive:
#!/bin/bash
v-imount -M "Samsung T5" -p "password" $@
To automatically backup to your encrypted volumes / file-containers, create a wrapper script in your path that you can execute easily whenever you want to perform a backup. e.g. with the script examples/backup that backs up the home folder:
#! /bin/bash
v-mount-and-exec -V Kingston -p "password" -w -- "backup $@"