1

I'm trying to auto-mount a VeraCrypt volume with the correct password, PIM and then wipe the cache.

If I try this via the terminal it works fine, like so:

/Applications/VeraCrypt.app/Contents/MacOS/VeraCrypt --auto-mount=favorites --pim 243 --password=mysupersecurepassword /c

I've also tried to to separate the arguments of the command into individual commands such as:

<string>/Applications/VeraCrypt.app/Contents/MacOS/VeraCrypt --auto-mount=favorites</string>
<string>--pim 243</string>
<string>--password=mysupersecurepassword</string>

Unfortunately, I'm not a programmer and don't have any grasp of basic syntax, so I'm just trying to following other guides and instructions which are failing me. Any ideas what's wrong in the code?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
    http://www.apple.com/DTDs/PropertyList-1.0.dtd>
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.veracrypt.auto-mount-favorites</string>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/Applications/VeraCrypt.app/Contents/MacOS/VeraCrypt --auto-mount=favorites --pim 243 --password=mysupersecurepassword /c</string>
</array>
</dict>
</plist>
2
  • Code aside, isn't that quite against the point of encryption? If your password is stored on your hard disk in plain text, anybody who has physical access to that machine could decrypt that volume.
    – gronostaj
    Nov 3, 2017 at 8:21
  • The password is on an encrypted drive (with 2FA) to no one has access to, unless they have the password, that is different from the volume. And I'm aware of any risks. Just trying to get the code to work. Nov 3, 2017 at 8:39

1 Answer 1

0

You are nearly there, but methinks that you have problem with your config.plist file. I use a keyfile and it don't bother me if someone tries to access the machine because I work in a locked office.

What I do is create two files, on that mounts it in roots directory with the key in roots home with permissions 600 called /var/root/.key and a script call veramountxyz.sh.

In the veramountxzy.sh, which I have put in /var/root I have the following:

#!/bin/sh
/Applications/VeraCrypt.app/Contents/MacOS/VeraCrypt --text --non-interactive --keyfiles="/var/root/.key"  --non-interactive --password="" --pim="0" --protect-hidden="no" /dev/rdisk0s3 /Volumes/vera

The password is empty and I needed the other options to get VeraCrypt to stop prompting. The UI is pretty useless IMHO.

In the config.plist I do this, placing the file in /Library/LaunchDaemon/ as mount.vera.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
       <key>Label</key>
        <string>mount.vera</string>
    <key>ProgramArguments</key>
    <array>
        <string>/bin/sh</string>
        <string>veramountxzy.sh</string>
    </array>
       <key>RunAtLoad</key>
       <true/>
       <key>KeepAlive</key>
       <false/>
    </dict>
  </plist>

Test and enable this by going launchctl load -w /Library/LaunchDaemons/mount.vera.plist as root.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .