seb*_*elk 10 unmounting ecryptfs
我已经为用户 piranha3 设置了一个加密的主目录:
root@raspberrypi:~# ecryptfs-verify -u piranha3 -h
INFO: [/home/piranha3/.ecryptfs] exists
INFO: [/home/piranha3/.ecryptfs/Private.sig] exists
INFO: [/home/piranha3/.ecryptfs/Private.sig] contains [2] signatures
INFO: [/home/piranha3/.ecryptfs/Private.mnt] exists
INFO: [/home/piranha3] is a directory
INFO: [/home/piranha3/.ecryptfs/auto-mount] Automount is set
INFO: Mount point [/home/piranha3] is the user's home
INFO: Ownership [piranha3] of mount point [/home/piranha3] is correct
INFO: Configuration valid
Run Code Online (Sandbox Code Playgroud)
但是在 piranha3 logouts 目录没有被卸载后:
root@raspberrypi:~# mount | grep ecryptfs
/home/.ecryptfs/piranha3/.Private on /home/piranha3 type ecryptfs (rw,nosuid,nodev,relatime,ecryptfs_fnek_sig=729061d7fa17b3a4,ecryptfs_sig=eb5ec4d9c13e2d74,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_unlink_sigs)
Run Code Online (Sandbox Code Playgroud)
lsof 输出:
lsof: WARNING: can't stat() cifs file system /media/cifs
Output information may be incomplete.
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
Run Code Online (Sandbox Code Playgroud)
系统信息:
root@raspberrypi:~# dpkg -l ecryptfs-utils
Deseado=desconocido(U)/Instalar/eliminaR/Purgar/retener(H)
| Estado=No/Inst/ficheros-Conf/desempaqUetado/medio-conF/medio-inst(H)/espera-disparo(W)/pendienTe-disparo
|/ Err?=(ninguno)/requiere-Reinst (Estado,Err: mayúsc.=malo)
||/ Nombre Versión Arquitectura Descripción
+++-========================-=================-=================-======================================================
ii ecryptfs-utils 103-5 armhf ecryptfs cryptographic filesystem (utilities)
root@raspberrypi:~# uname -a
Linux raspberrypi 4.1.13-v7+ #826 SMP PREEMPT Fri Nov 13 20:19:03 GMT 2015 armv7l GNU/Linux
Run Code Online (Sandbox Code Playgroud)
最后关于 PAM:
root@raspberrypi:~# grep -r ecryptfs /etc/pam.d
/etc/pam.d/common-session:session optional pam_ecryptfs.so unwrap
/etc/pam.d/common-password:password optional pam_ecryptfs.so
/etc/pam.d/common-auth:auth optional pam_ecryptfs.so unwrap
/etc/pam.d/common-session-noninteractive:session optional pam_ecryptfs.so unwrap
Run Code Online (Sandbox Code Playgroud)
为什么不卸载 /home/directory?
小智 1
请打开终端并按照这些说明进行操作。
cd /etc/systemd/system
sudo nano ecryptfs-umount-private.service
Run Code Online (Sandbox Code Playgroud)
将以下内容输入到文件中。
[Unit]
Description=Umount Private directory
Before=systemd-exit.service
DefaultDependencies=no
Requires=shutdown.target
After=shutdown.target
[Service]
Type=oneshot
ExecStart=/usr/bin/ecryptfs-umount-private
[Install]
WantedBy=exit.target
Run Code Online (Sandbox Code Playgroud)
按Ctrl+ X,然后按y和Enter键保存文件。
sudo systemctl daemon-reload
sudo systemctl enable ecryptfs-umount-private.service
Run Code Online (Sandbox Code Playgroud)
我已经测试过这个并且它对我有用。
我做的另一件事可能有帮助也可能没有帮助,那就是编辑/etc/systemd/logind.conf该行并将其更改#KillUserProcesses=no为KillUserProcesses=yes.
PS 我通过切换用户、注销、重新登录到主帐户然后使用 root 进行测试来测试这一点ls /home/folder name。我注意到有一点延迟,但这对我在带有 Gnome 的 Ubuntu 17.04 上有效。