I have several drives encrypted with VeraCrypt and I wanted to be able to mount them all to automount when I insert a drive containing their keyfiles. This way I only have to decrypt the flash drive that contains the keyfiles and only type in one password. I created an automation program in Nim to handle this: https://github.com/TomAshley303/veramount
My usage is to have my veramount program run on each boot. The problem is that in order to mount a VeraCrypt volume you need to supply a sudo password, so I added VeraCrypt to
However it simply didn't work. Each time my veramount program runs, VeraCrypt isn't given sudo access. If I run veramount from the command line after authenticating to sudo, for instance after running something like
sudo ls, it works fine. I thought maybe this was because the calling program (veramount) needed to be added to sudoers but that didn't work either. I wound up with the following:
%veracrypt ALL=(ALL:ALL) NOPASSWD: /usr/bin/veracrypt %veramount ALL=(ALL:ALL) NOPASSWD: /home/user/Code/nim/mountkey/veramount
Is there something wrong with my sudoers rule? Something must be wrong.
Edit: I realize that in my Nim code I don't use the sudo command to run VeraCrypt. This is because I want my drives to be mounted with permissions for my user account and because when you use VeraCrypt to mount a drive, it automatically prompts you with a popup dialog for your sudo password anyway.