同學您好:
BTRFS Sysadmin Wiki 中建議僅在需要時 mount(例如操作 snapshot 時),並在操作結束後隨即 unmoumt
至於不建議將 root volume (subvolid=5) 一直持續掛載的理由,以下是原文節錄:
Care must be taken when snapshots are created that are then visible to
any user (e.g. when they're created in a nested layout) as this may have
security implications.
Of course, the snapshot will have the same permissions as the subvolume
from which it was created at the time it was, but these permissions may
be tightened later on, while those of the snapshot wouldn't change,
possibly allowing access to files that shouldn't be accessible anymore.
Similarly, especially on the system's "main" filesystem, the snapshot
would contain any files (for example setuid programs) of the state when
it was created. In the meantime however, security updates may have been
rolled out on the original subvolume, but when the snapshot is
accessible (and for example the vulnerable setuid has been accessible
before) a user could still invoke it.
大致來說,root volume 若
持續掛載,可能使一部分使用者能夠直接
摸到作為 snapshot 的 subvolume。這些 snapshot 中的 file 的 permission 和 state 都會保持在打 snapshot 的那一刻。即使管理員後來做了 security patch 去縮緊權限,也不會改到 snapshot 內的狀態,所以能直接 read snapshot 的 user 就有機會碰到一些他(現今)不該碰到的檔案。
此外,你也可能會想將一些與管理 BTRFS 相關的檔案放在 root volume 內。持續掛載 root volume 也會增加這些 data leak 的風險
不過因為這次作業中都不會涉及以上情境,因此並未要求。
希望這樣有為您解惑。
TA hsuchy