我的主机系统是 archlinux,我需要一个准备好与我的主目录中的文件一起使用的 ubuntu 环境。问题是:我的主目录是使用 ecryptfs 加密的。所以当我启动 schroot 时,我得到的是:
~ $ schroot -c ubuntu-lts
(ubuntu-lts) ~ $ ls
Access-Your-Private-Data.desktop README.txt
我如何自动挂载我的加密主目录(可能无需重新输入密码)。
为了在 archlinux 上设置我的加密主页,我遵循以下步骤:
- https://wiki.archlinux.org/index.php/ECryptfs#Encrypting_a_home_directory
- https://wiki.archlinux.org/index.php/ECryptfs#Auto-mounting
我的 schroot 设置非常简单:
~ $ cat /etc/schroot/chroot.d/ubuntu-lts.conf
[ubuntu-lts]
type=directory
description=Ubuntu 18.04 LTS
directory=/opt/schroot/ubuntu-lts
users=<my username>
aliases=ubuntu-18.04,ubuntu-bionic,bionic
答案1
一段时间后我找到了解决方案:
根设置:
[ubuntu-lts]
type=directory
description=Ubuntu 18.04 LTS
directory=/opt/schroot/ubuntu-lts
users=<your-username>
aliases=ubuntu-18.04,ubuntu-bionic,bionic
setup.fstab=ubuntu-lts/fstab
fstab 文件变为:
# fstab: static file system information for chroots.
# Note that the mount point will be prefixed by the chroot path
# (CHROOT_PATH)
#
# <file system> <mount point> <type> <options> <dump> <pass>
/proc /proc none rw,bind 0 0
/sys /sys none rw,bind 0 0
/dev /dev none rw,bind 0 0
/dev/pts /dev/pts none rw,bind 0 0
/home /home none rw,bind 0 0
/tmp /tmp none rw,bind 0 0
/home/<your-username> /home/<your-username> none rw,bind 0 0
# It may be desirable to have access to /run, especially if you wish
# to run additional services in the chroot. However, note that this
# may potentially cause undesirable behaviour on upgrades, such as
# killing services on the host.
#/run /run none rw,bind 0 0
#/run/lock /run/lock none rw,bind 0 0
#/dev/shm /dev/shm none rw,bind 0 0
这只是从 /etc/schroot/default/fstab 复制到 /etc/schroot/ubuntu-lts/fstab 的 fstab 文件,我在其中添加了这一行:
/home/<your-username> /home/<your-username> none rw,bind 0 0