linux - 自动挂载加密分区

标签 linux bash ubuntu luks

我的 Ubuntu 上有一个加密分区(使用 cryptsetup 加密)。

目前,我使用以下命令挂载分区

sudo cryptsetup luksOpen /dev/sda1 backup && wait && sudo mount /dev/mapper/backup /backup

它会提示您进行释义。

那么有没有办法将此行放入脚本中并自动挂载分区(以便进行每日备份),如下所示:

sudo cryptsetup luksOpen /dev/sda1 backup < paraphrase

或更好:

sudo cryptsetup luksOpen /dev/sda1 backup < hashed_paraphrase

最佳答案

来自 cryptsetup(8) 手册页:

   --key-file, -d name
          Read the passphrase from file.

          If  the name given is "-", then the passphrase will be read from
          stdin.  In this case, reading will not stop at  newline  charac‐
          ters.

关于linux - 自动挂载加密分区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36405906/

相关文章:

c++ - 如何在 C++ 中移动角色

linux - 使用 Mercurial 必须使用 Mercurial Server 吗?

javascript - MeteorJS 不会停止创建启动文件

linux - 记录内存访问足迹

ubuntu - 为什么我的 apache2 设置总是导致 301 Moved Permanently

ubuntu - apt-get update' 返回一个非零代码 : 100

r - Ubuntu R ForEach/DoMC 不使用多核

regex - 使用 sed 和 regex 更改 bash 中不包括变量的每个符号

string - 如何在 awk 表达式中使用变量

linux - 广播语句的限制值