Mounting Veracrypt container during boot

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
t42
Level 11
Level 11
Posts: 3732
Joined: Mon Jan 20, 2014 6:48 pm

Mounting Veracrypt container during boot

Post by t42 »

This will mount Veracrypt container using systemd with no VeraCrypt involvement.

1. Create or copy Veracrypt container:
/home/USER/Documents/cont/test_202109
Change USER and path as required

2. Edit crypttab

Code: Select all

sudo nano /etc/crypttab
insert this line

Code: Select all

volume_vc1 /home/USER/Documents/cont/test_202109 none tcrypt-veracrypt
volume_vc1 is a name you choose

3. Create mount point

Code: Select all

sudo mkdir /mnt/volume_vc1
4. Edit fstab, insert line

Code: Select all

/dev/mapper/volume_vc1 /mnt/volume_vc1 auto nosuid,nodev,nofail 0 0
5. Reboot. Enter the password when prompted (there is only one attempt, no retries)

6. Browse to /mnt/volume_vc1

7. To check if a container is mounted:

Code: Select all

mount |grep /dev/mapper/
# sample output
/dev/mapper/volume_vc1 on /mnt/volume_vc1 type ext4 (rw,nosuid,nodev,relatime)
7. To dismount a container

Code: Select all

 sudo umount /dev/mapper/volume_vc1
8. To disable the container on boot just comment out the /dev/mapper/ line in /etc/fstab
Last edited by t42 on Mon Aug 08, 2022 4:22 pm, edited 2 times in total.
-=t42=-
User avatar
Lady Fitzgerald
Level 15
Level 15
Posts: 5806
Joined: Tue Jan 07, 2020 3:12 pm
Location: AZ, SSA (Squabbling States of America)

Re: Mounting Veracrypt container during boot

Post by Lady Fitzgerald »

Uh...why would you want to mount a Veracrypt container during boot? Wouldn't that at least partially defeat the purpose of having an encrypted container?
Jeannie

To ensure the safety of your data, you have to be proactive, not reactive, so, back it up!
t42
Level 11
Level 11
Posts: 3732
Joined: Mon Jan 20, 2014 6:48 pm

Re: Mounting Veracrypt container during boot

Post by t42 »

Lady Fitzgerald wrote: Tue Sep 21, 2021 11:11 am why would you want to mount a Veracrypt container during boot? Wouldn't that at least partially defeat the purpose of having an encrypted container?
It's a valid question because the need in that may be rare ideed. It may be convenient in case you need to mount a container on each boot not tinkering with GUI. Also it may be expedient if you modify setup to use the keys instead of password for greater discretion and security (placed on USB or card). Also feasible in certain environment where you can't have VeraCrypt application on the system or be seen using it ...or other cool staff :)
I posted about that because the possibility is less known.
-=t42=-
User avatar
Lady Fitzgerald
Level 15
Level 15
Posts: 5806
Joined: Tue Jan 07, 2020 3:12 pm
Location: AZ, SSA (Squabbling States of America)

Re: Mounting Veracrypt container during boot

Post by Lady Fitzgerald »

t42 wrote: Tue Sep 21, 2021 11:33 am
Lady Fitzgerald wrote: Tue Sep 21, 2021 11:11 am why would you want to mount a Veracrypt container during boot? Wouldn't that at least partially defeat the purpose of having an encrypted container?
It's a valid question because the need in that may be rare ideed. It may be convenient in case you need to mount a container on each boot not tinkering with GUI. Also it may be expedient if you modify setup to use the keys instead of password for greater discretion and security (placed on USB or card). Also feasible in certain environment where you can't have VeraCrypt application on the system or be seen using it ...or other cool staff :)
I posted about that because the possibility is less known.
OK, that makes sense. Thanks for edjumacating me.
Jeannie

To ensure the safety of your data, you have to be proactive, not reactive, so, back it up!
Post Reply

Return to “Tutorials”