登录时自动挂载 VeraCrypt 卷(Mac OS)/w Launchagent

登录时自动挂载 VeraCrypt 卷(Mac OS)/w Launchagent

我正在尝试使用正确的密码 PIM 自动挂载 VeraCrypt 卷,然后擦除缓存。

如果我通过终端尝试这个,它可以正常工作,如下所示:

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

我还尝试将命令的参数分离为单独的命令,例如:

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

不幸的是,我不是一名程序员,也不了解基本的语法,所以我只是尝试遵循其他让我失望的指南和说明。您知道代码中有什么问题吗?

<?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>

答案1

您几乎已经完成了,但我认为您的config.plist文件有问题。我使用密钥文件,如果有人试图访问机器,我不会介意,因为我在上锁的办公室工作。

我要做的是创建两个文件,将其安装在根目录中,在根目录中使用权限为 600 的密钥调用/var/root/.key并调用脚本veramountxyz.sh

veramountxzy.sh在我输入的中/var/root,我有以下内容:

#!/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

密码为空,我需要其他选项来让 VeraCrypt 停止提示。在我看来,用户界面相当没用。

config.plist我这样做的时候,将文件/Library/LaunchDaemon/放在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>

以 root身份测试并启用此功能launchctl load -w /Library/LaunchDaemons/mount.vera.plist

相关内容