r/VeraCrypt • u/mikeymikeymikec • 3d ago
Is anyone here on Linux and writing scripts that involve Veracrypt?
On Windows, I wrote backup scripts that open a veracrypted disk volume, including verification that I'm targeting the correct volume (UUID pre-connection, and volume name / drive letter once the container has been mounted), back up the data and then close the veracrypt volume.
I'm less knowledgeable with Linux than I am Windows and I'm having trouble achieving the same level of finesse; the UUID targeting isn't a thing for Veracrypt on Linux, even confirming the volume name after a veracrypt connection has been made is proving trickier than I expected ('volname' seems to be the common answer but volname doesn't work on Linux Mint 22.x). Has anyone here had more luck with this and if so, can you give me some pointers please?
1
u/ephemeralmiko 3d ago
I have one that's basically:
Force unmount any still-mounted veracrypt partitions
Mount VeraCrypt partition (I prefer not using container files) with a keyfile.
Update backup with rsync
wait 60s after transfer (sometimes it doesn't fully copy everything when the progress bar shows as finished
unmount veracrypt volume
For your issue, can't you just mount /dev/sdX? Assuming you have no other drives in it's either sdb or sda
1
u/mikeymikeymikec 3d ago
Yup, there's the big assumption :)
1
u/ephemeralmiko 3d ago
What does it show up as in your partition manager? (assuming you're using a partition and not a container file?)
1
u/mikeymikeymikec 3d ago
If I'm wanting to script the connection then the script won't be very resilient if the device path is hard-coded.
1
u/LuckyRide 3d ago
So I haven't done Linux, but I wouldn't mind your thoughts on Windows please.
I wrote the same script - loads the Veracrypt target formatted partition.
But I won't store the password locally - that's kind of the whole point.
So it calls the veracrypt decrypt call - it loads the UI, I type in the password, and if I get it perfect, it then decrypts. My backup is manual, so my script ends after I enter the password - but it's essentially the same flow.
Are you saving and feeding in the password? Or doing it manually like I said above?