chrootにecryptfsホーム自動マウント(schrootを使用する場合)

chrootにecryptfsホーム自動マウント(schrootを使用する場合)

私のホストシステムはArchlinuxであり、私のホームディレクトリのファイルで使用できるUbuntu環境が必要です。問題は、私のホームディレクトリがecryptfsを使用して暗号化されることです。そのため、schrootを起動すると、次のような結果が得られます。

 ~ $ schroot -c ubuntu-lts
(ubuntu-lts) ~ $ ls
Access-Your-Private-Data.desktop  README.txt

暗号化されたホームディレクトリを自動的にマウントするにはどうすればよいですか(おそらくパスワードを再入力せずに)。

Archlinuxで暗号化されたホームページを設定するには、次の手順を実行しました。

私の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

おすすめ記事