oce*_*nBT 9 shutdown mount veracrypt
veracrypt 中是否有自动卸载功能,还是应该在关闭之前手动卸载 veracrypt 卷以防止文件系统/容器损坏?
我在veracrypt FAQ 中找到了适用于 Windows 的答案,但没有找到适用于 Linux / Ubuntu的答案。
有所谓的运行级别,当进入一个新的运行级别时,脚本就会被执行。在 Ubuntu 上,这些存储在/etc/rc<run level>.d. 运行级别 0 是关闭,运行级别 6 是重新启动。所以你希望你的脚本/etc/rc0.d在/etc/rc6.d.
创建文件/etc/init.d/unmount-veracrypt-volumes.sh并将其设为内容:
#!/bin/sh
veracrypt -d -f
sleep 3
Run Code Online (Sandbox Code Playgroud)
然后执行这些命令:
sudo chown root /etc/init.d/unmount-veracrypt-volumes.sh
sudo chmod 751 /etc/init.d/unmount-veracrypt-volumes.sh
sudo ln -s /etc/init.d/unmount-veracrypt-volumes.sh /etc/rc0.d/K00-unmount-veracrypt-volumes.sh
sudo ln -s /etc/init.d/unmount-veracrypt-volumes.sh /etc/rc6.d/K00-unmount-veracrypt-volumes.sh
Run Code Online (Sandbox Code Playgroud)
我选择K00这样当输入一个运行级别时脚本作为第一个执行。这些脚本以 ASCII 递增的顺序执行,因此符号链接名称的数字越小,脚本执行得越早。
这是更新,这应该是正确的答案!
我在 veracrypt 论坛中了解到,在 1.19 版本中引入了在关闭和/或挂起时控制卸载的选项。无需创建上述 init.d 脚本。
你可以亲自看看这个。我使用Ubuntu ppa提供的veracrypt包,其中有一个名为的文件,/etc/default/veracrypt其中包含以下设置:
# If enabled, the following option calls 'veracrypt -d' at shutdown. Although
# all filesystems are unmounted automatically at shutdown, only calling
# 'veracrypt -d' will stop the VeraCrypt processes and remove any device mappings.
# It probably isn't necessary to do this, but it shouldn't hurt.
VERACRYPT_SHUTDOWN_UNMOUNT="yes"
# If enabled, the following option calls 'veracrypt -d' during suspend and hibernate.
VERACRYPT_SUSPEND_UNMOUNT="yes"
Run Code Online (Sandbox Code Playgroud)
如果您想尝试,这里是 ppa 文件:
deb http://ppa.launchpad.net/unit193/encryption/ubuntu cosmic main
deb-src http://ppa.launchpad.net/unit193/encryption/ubuntu cosmic main
Run Code Online (Sandbox Code Playgroud)
以及截至 2018-12-26 的版本veracrypt-1.23.0vanirl~18.10。
| 归档时间: |
|
| 查看次数: |
10363 次 |
| 最近记录: |