So I have multiple hard drives encrypted with the same password and instead of having to enter it multiple times I'd like to have it set up so that after booting I automatically get a password-box displayed into which I enter the password once and which then mounts all the encrypted hard drives and securely removes the password from cache/memory afterwards.

Can this be done somehow? If it's not possible via the GUI maybe via a script? I'm using Debian 9.1 with KDE.

  • So I assume you want some sort of Bash script? It should be possible to prompt for input, store that input into a variable, then pass that variable to your mount commands – Ramhound Aug 23 '17 at 16:04
  • No, I was hoping this was possible via standard VeraCrypt. But if not I'd be interested in any information that would be useful for writing such a script. Such as commands to securely delete the password and commands to mount VeraCrypt volumes. I'd then also be interested in why it's not featured via VeraCrypt itself (are there security reasons for that?). – mYnDstrEAm Aug 23 '17 at 16:15
  • I am not going to speculate the reasons it isn't a feature of VeraCrypt. You should ask the developers the reason it isn't a feature if you want to know the answer to that question. – Ramhound Aug 23 '17 at 16:19

This script works:

read -s password
echo $password | sudo veracrypt --text --mount --stdin --non-interactive /dev/sdb /mount/drive_b
echo $password | sudo veracrypt --text --mount --stdin --non-interactive /dev/sdc /mount/drive_c

I'm not sure how secure this is but better than using the --password option since that shows up in ps.


The "Auto-Mount Devices" feature is still available, at least in VeraCrypt 1.21.

There is a button available in the UI, or the following command will ask for the password/keyfiles/PIM once, and automatically mount multiple volumes, if they exist:

"VeraCrypt.exe" /auto devices /history n /cache n /quit
  • It's true that there is such a GUI option in VeraCrypt for Linux (about which this question is), but not in the command line tool. The -c and -C switches have entirely different meaning in the Linux version than the /c (to cache the password) for example. And there is no counterpart to /w (wipe password cache) either. – 0xC0000022L Sep 1 '18 at 14:44

In TrueCrypt this WAS possible. If, for instance, 4 volumes are loaded at logon and these volumes have the same password, then the password only needs to be filled out once in the text box. Obviously this feature has delibarately been removed with VeraCrypt. I do not understand why, because if you want to avoid this behaviour you can give your volumes different pass words.

I find this so unhandy that I decided to stay with TrueCrypt, despite the security risks.


What I do is have a bat file that runs on startup for my PC that waits for the 2nd and 3rd drive to be mounted on my system then wipes the cache using the command line, you can then use a 3rd program to hide the command prompt if you like, example: hstart.exe

The batch file loops adding 1 every ten seconds to a variable, if it ever gets to 60 (600 seconds give or take) the bat file closes so it doesn't run in the background forever.

The DriveExists.txt text file doesn't even need anything in it, it just needs to exist.

@echo off
echo this window will close when the H and J drives exists
set LoopCount=1
IF not exist H:\DriveExists.txt (
    timeout 10 /nobreak > nul
    set /a LoopCount=%LoopCount%+1
    if %LoopCount% equ 60 ( goto endOfScriptLabel )
    goto waitLabel
echo past H
set /a LoopCount=0
IF not exist J:\DriveExists.txt (
    timeout 10 /nobreak > nul
    set /a LoopCount=%LoopCount%+1
    if %LoopCount% equ 60 ( goto endOfScriptLabel )
    goto waitLabelTwo
echo past J
REM the following if is only to indent the items run after mounting volumes
IF exist H:\DriveExists.txt (
    REM other code removed for example.
    cd C:\Program Files\VeraCrypt
    veracrypt /w
@echo on
  • 2
    -1. The question seeks solution for Debian explicitly. Besides, I'm not convinced if your answer does (on Windows) what the asker wants. – Kamil Maciorowski Nov 29 '17 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.