Ubuntu
在 chroot 中自動掛載 ecryptfs home(使用 schroot 時)
我的主機系統是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
一段時間後我找到了解決方案:
廢料設置:
[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/ubuntu-lts/fstab 中的 /etc/schroot/default/fstab 複製的 fstab 文件,我在其中添加了這一行:
/home/<your-username> /home/<your-username> none rw,bind 0 0