如何在 Linux Mint 17.2 中恢复加密的 /home/ 文件夹

Del*_*acy 5 password linux-mint disk-encryption

问题: 我今天早些时候更改了密码,但我一定是打错了,因为之后我无法登录。我启动到 Grub 菜单并启动了一个无密码的 root shell 来重置我的密码。这很成功,因为我现在可以输入新密码并通过登录屏幕。但是,一旦我这样做,我就会收到一条错误消息:

Your session only lasted less than 10 seconds. If you have not logged out yourself, this could mean there is some installation problem, or that you may be out of diskspace. Try logging in with one of the failsafe sessions to see if you can fix this problem.

syndaemon: no process found
/etc/mdm/Xsession: Beginning session setup...
localuser:[username] being added to access control list
Can't create dir /home/[username]/Desktop
Can't create dir /home/[username]/Downloads
Can't create dir /home/[username]/Templates
Can't create dir /home/[username]/Public
Can't create dir /home/[username]/Documents
Can't create dir /home/[username]/Music
Can't create dir /home/[username]/Pictures
Can't create dir /home/[username]/Videos
Script for none started at run_im
Script for auto started at run_im
Script for default started at run_im
init: session.migration main process (2322)terminated with status 1
init: logrotate main process (2304) killed by TERM signal
init: Disconnected from notified D-Bus bus
Run Code Online (Sandbox Code Playgroud)

我可以选择点击“确定”,这将带我回到登录屏幕。如果我再次尝试登录,我会收到完全相同的消息。

注意:在上面的文本中显示 [username] 的地方,实际错误显示了我的实际用户名。然而,当谈到我的在线身份时,我很偏执,因此我在上面打印的错误中对其进行了审查。

我试过了:

  • 使用硬启动和登录屏幕上的关闭按钮重新启动计算机
  • 在恢复模式下启动并运行“修复损坏的包”和“检查所有文件”(可能是“所有目录”,我不记得了)
  • 我已经用谷歌搜索并搜索了我所知道的每个知识库,但没有找到解决办法
  • 我在linuxquestions.org 上问过
  • 尝试使用相同的用户名删除并重新创建我的帐户
  • 还; 我刚刚尝试使用命令行访问我的加密文件,但失败了

     mint@mint ~ $  ecryptfs-mount-private
     ERROR: Encrypted private directory is not setup properly
    
    Run Code Online (Sandbox Code Playgroud)

    还有

    mint@mint ~ $ ecryptfs-unwrap-passphrase /media/34e5c4fa-0621-46cb-83b0-763c2a0dc49c/home/.private/[username]/.ecryptfs/wrapped-passphrase
    Passphrase: 
    Error: Unwrapping passphrase failed [-2]
    Info: Check the system log for more information from libecryptfs
    
    Run Code Online (Sandbox Code Playgroud)

    它与磁盘空间无关(我试图进入最大的驱动器,在底部):

    mint@mint ~ $ df
    df: ‘/root/.gvfs’: Permission denied
    Filesystem                1K-blocks      Used Available Use% Mounted on
    /cow                        2032928   1676256    250076  88% /
    udev                        1979616         4   1979612   1% /dev
    tmpfs                        404796      1552    403244   1% /run
    /dev/sdb1                   3908100   3876388     31712 100% /cdrom
    /dev/loop0                  1523456   1523456         0 100% /rofs
    none                              4         0         4   0% /sys/fs/cgroup
    tmpfs                       2023964        16   2023948   1% /tmp
    none                           5120         0      5120   0% /run/lock
    none                        2023964        84   2023880   1% /run/shm
    none                         102400        28    102372   1% /run/user
    /dev/mapper/mint--vg-root 956884652 103557812 804696876  12% /media/mint/34e5c4fa-0621-46cb-83b0-763c2a0dc49c
    
    Run Code Online (Sandbox Code Playgroud)

    也试过下面的。它挂载文件,但不解密

    mint@mint ~ $ sudo ecryptfs-recover-private
    INFO: Searching for encrypted private directories (this might take a while)...
    INFO: Found [/media/mint/34e5c4fa-0621-46cb-83b0-763c2a0dc49c/home/.ecryptfs/tijmen/.Private].
    Try to recover this directory? [Y/n]: y
    INFO: Found your wrapped-passphrase
    Do you know your LOGIN passphrase? [Y/n] y
    INFO: Enter your LOGIN passphrase...
    Passphrase: 
    Error: Unwrapping passphrase and inserting into the user session keyring failed [-5]
    Info: Check the system log for more information from libecryptfs
    mint@mint ~ $ sudo ecryptfs-recover-private
    INFO: Searching for encrypted private directories (this might take a while)...
    INFO: Found [/media/mint/34e5c4fa-0621-46cb-83b0-763c2a0dc49c/home/.ecryptfs/tijmen/.Private].
    Try to recover this directory? [Y/n]: y
    INFO: Found your wrapped-passphrase
    Do you know your LOGIN passphrase? [Y/n] n
    INFO: To recover this directory, you MUST have your original MOUNT passphrase.
    INFO: When you first setup your encrypted private directory, you were told to record
    INFO: your MOUNT passphrase.
    INFO: It should be 32 characters long, consisting of [0-9] and [a-f].
    
    Enter your MOUNT passphrase: 
    INFO: Success!  Private data mounted at [/tmp/ecryptfs.cQtlJNMc].
    mint@mint ~ $
    
    Run Code Online (Sandbox Code Playgroud)

    其他相关信息 我在 1TB 外置硬盘上运行 Linux Mint 17.2,因为我的内置硬盘在几个月前就死了。到目前为止,这就像一个魅力。我现在使用的是实时 USB 驱动器,因为我希望能够检索一些基本文件(例如我的 KeePass 数据库文件),但是在安装过程中通过使用“加密分区”选项对外部 HDD 上的安装进行了加密.

    我已经使用 Linux Mint 大约 6-8 个月了,所以我对终端的日常使用有点精通,但我对 Linux 的底层工作原理和 root 命令选项完全一无所知我的处置。

    这是我在实时 USB 上使用的 Linux 发行版,与我安装在外部硬盘驱动器上的发行版相同

    mint@mint ~ $  cat /etc/*-release
    DISTRIB_ID=LinuxMint
    DISTRIB_RELEASE=17.2
    DISTRIB_CODENAME=rafaela
    DISTRIB_DESCRIPTION="Linux Mint 17.2 Rafaela"
    NAME="Ubuntu"
    VERSION="14.04.2 LTS, Trusty Tahr"
    ID=ubuntu
    ID_LIKE=debian
    PRETTY_NAME="Ubuntu 14.04.2 LTS"
    VERSION_ID="14.04"
    HOME_URL="http://www.ubuntu.com/"
    SUPPORT_URL="http://help.ubuntu.com/"
    BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
    cat: /etc/upstream-release: Is a directory
    
    Run Code Online (Sandbox Code Playgroud)

    这是内核 Linux 3.16.0-38-generic x86_64

    我可以使用实时 USB 查看我的所有文件夹和文件,但由于它们是加密的,我实际上无法访问它们。

    ----第一次回答后更新---- GAD3R 建议我

    Boot using Linux-mint LiveCD
    
    Make sure that your target system's hard drive is mounted
    
    Open a terminal
    
    Install ecryptfs-utils documentation
    
    sudo apt-get install -y ecryptfs-utils
    
    And run
    
    sudo ecryptfs-recover-private
    
    Follow the prompts
    
    Run Code Online (Sandbox Code Playgroud)

    不幸的是,这不起作用。

    mint@mint ~ $ sudo apt-get install -y ecryptfs-utils
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    ecryptfs-utils is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 326 not upgraded.
    mint@mint ~ $ sudo ecryptfs-recover-private
    INFO: Searching for encrypted private directories (this might take a while)...
    INFO: Found [/media/mint/34e5c4fa-0621-46cb-83b0-763c2a0dc49c/home/.ecryptfs/tijmen/.Private].
    Try to recover this directory? [Y/n]: y
    INFO: Found your wrapped-passphrase
    Do you know your LOGIN passphrase? [Y/n] y
    INFO: Enter your LOGIN passphrase...
    Passphrase: 
    Error: Unwrapping passphrase and inserting into the user session keyring failed [-5]
    Info: Check the system log for more information from libecryptfs
    mint@mint ~ $ 
    
    Run Code Online (Sandbox Code Playgroud)