ecryptfs: 자동 제거가 작동하지 않습니다

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

그러나 piranha3이 로그아웃한 후에도 해당 디렉토리는 제거되지 않았습니다:

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)

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.

시스템 메시지:

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

마지막으로 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

/home/directory가 마운트 해제되지 않는 이유는 무엇입니까?

답변1

터미널을 열고 다음 지침을 따르십시오.

cd /etc/systemd/system
sudo nano ecryptfs-umount-private.service

파일에 다음 내용을 입력합니다.

[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

Ctrl+를 누른 X다음 yEnter키를 눌러 파일을 저장합니다.

sudo systemctl daemon-reload
sudo systemctl enable ecryptfs-umount-private.service

나는 이것을 테스트했고 그것은 나에게 효과적입니다.

도움이 될 수도 있고 그렇지 않을 수도 있는 또 다른 일은 /etc/systemd/logind.conf줄을 #KillUserProcesses=no편집 하여 KillUserProcesses=yes.

PS 저는 이것을 사용자 전환, 로그아웃, 기본 계정에 다시 로그인한 다음 root 로 테스트하여 테스트했습니다 ls /home/folder name. 약간의 지연이 발견되었지만 이는 Gnome을 사용하는 Ubuntu 17.04에서 작동합니다.

답변2

askubuntu의 사용자에 따르면 이것은 알려진 버그입니다.https://askubuntu.com/a/932650. 사실인지 아닌지는 모르겠지만 해결책을 찾았습니다.

.bash_logout 끝에 다음 줄을 추가했습니다(예: vim ~/.bash_logout):

(sleep 10; ecryptfs-umount-private) &

로그아웃(ssh 연결)하면 "세션이 아직 열려 있지만 마운트 해제되지 않았습니다"라는 메시지가 표시되지만 어쨌든 내 홈 디렉터리는 마운트 해제/암호화됩니다.

관련 정보