AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 493931
Accepted
Faither
Faither
Asked: 2019-01-12 03:21:53 +0800 CST2019-01-12 03:21:53 +0800 CST 2019-01-12 03:21:53 +0800 CST

“ecryptfs-mount-private”返回“fopen:没有这样的文件或目录”

  • 772

最近,我们重启了服务器,发现 ecryptfs 挂载失败:

...
在用户密钥环中找不到签名
也许尝试交互式'ecryptfs-mount-private'
user@host:~$

可能是因为密码更改?

虽然,

1. There's no mount password
2. We might have login password

尝试恢复挂载目录时,它会输出:

user@host:~$ ls
Access-Your-Private-Data.desktop  README.txt
user@host:~$ ecryptfs-mount-private
Enter your login passphrase:
Error: Unwrapping passphrase and inserting into the user session keyring failed [-5]
Info: Check the system log for more information from libecryptfs
ERROR: Your passphrase is incorrect
Enter your login passphrase:
user@host:~$ sudo ecryptfs-mount-private
[sudo] password for user:
Enter your login passphrase:
Inserted auth tok with sig [ad21fabcda6abfeab] into the user session keyring
fopen: No such file or directory
user@host:~$

因此,如您所见,它显示了如此奇怪的错误:fopen: No such file or directory而且,当没有运行时ecryptfs-mount-private-sudo它失败了。使用ecrypts-recover-private和登录密码安装文件夹时,它会像魅力一样将其安装在临时文件夹中。
此外,我们已经尝试过ecryptfs-rewrap-password,但如果没有 sudo. 因此,使用sudo ecryptfs-rewrap-password成功重新包装,但重新启动后相同的情况仍然存在。

总而言之,这可能是什么;如何在登录时修复此自动挂载加密主目录?

mount password
  • 2 2 个回答
  • 2682 Views

2 个回答

  • Voted
  1. Faither
    2019-01-12T13:30:17+08:002019-01-12T13:30:17+08:00

    简而言之,用户的文件wrapped-passphrase有错误的权限(应该是-rw------- user user,是-rw------- root root)。

    Ranecryptfs-mount-private命令(输入的登录密码)使用strace如下:

    strace -o /tmp/strace.log -e trace=file ecryptfs-mount-private
    

    内容/tmp/strace.log:

    user@host:~$ sudo strace -o /tmp/strace.log -e trace=file ecryptfs-mount-private
    [sudo] password for user:
    Enter your login passphrase:
    Inserted auth tok with sig [3ab5cd8e5f8c5acb] into the user session keyring
    fopen: No such file or directory
    user@host:~$ cat /tmp/strace.log
    execve("/usr/bin/ecryptfs-mount-private", ["ecryptfs-mount-private"], [/* 13 vars */]) = 0
    access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
    access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
    open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
    access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
    open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
    getcwd("/home/user", 4096)                = 9
    open("/usr/bin/ecryptfs-mount-private", O_RDONLY) = 3
    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3872, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
    stat("/home/user/.ecryptfs/wrapping-independent", 0x7fff65e61c30) = -1 ENOENT (No such file or directory)
    open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3873, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
    stat("/home/user/.ecryptfs/wrapped-passphrase", {st_mode=S_IFREG|0600, st_size=58, ...}) = 0
    stat("/home/user/.ecryptfs/Private.sig", {st_mode=S_IFREG|0600, st_size=34, ...}) = 0
    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3874, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
    stat("/usr/local/sbin/stty", 0x7fff65e61c40) = -1 ENOENT (No such file or directory)
    stat("/usr/local/bin/stty", 0x7fff65e61c40) = -1 ENOENT (No such file or directory)
    stat("/usr/sbin/stty", 0x7fff65e61c40)  = -1 ENOENT (No such file or directory)
    stat("/usr/bin/stty", 0x7fff65e61c40)   = -1 ENOENT (No such file or directory)
    stat("/sbin/stty", 0x7fff65e61c40)      = -1 ENOENT (No such file or directory)
    stat("/bin/stty", {st_mode=S_IFREG|0755, st_size=72496, ...}) = 0
    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3875, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3876, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3877, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3878, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3879, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3880, si_uid=0, si_status=0, si_utime=68, si_stime=0} ---
    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3881, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
    +++ exited with 1 +++
    

    所以,我们看到没有足够的信息。运行相同的命令(输入登录密码),但使用标志-f来跟踪子进程并使用root权限:

    sudo strace -o /tmp/strace2.log -f -e trace=file ecryptfs-mount-private`
    

    部分/tmp/strace2.log文件内容:

    ...
    3963  open("/root/.ecryptfsrc", O_RDONLY) = -1 ENOENT (No such file or directory)
    3963  open("/home/user/.ecryptfs/wrapped-passphrase", O_RDONLY) = 3
    ...
    3964  open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
    3964  open("/root/.ecryptfs/Private.mnt", O_RDONLY) = -1 ENOENT (No such file or directory)
    3964  open("/dev/shm/ecryptfs-root-Private", O_RDWR|O_CREAT|O_NOFOLLOW, 0600) = 3
    3964  open("/root/.ecryptfs/Private.sig", O_RDONLY) = -1 ENOENT (No such file or directory)
    3964  +++ exited with 1 +++
    3954  --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3964, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
    3954  +++ exited with 1 +++
    

    如我们所见,它找不到root的文件Private.sig;看起来它应该由我们尝试恢复的加密目录的用户运行,而不是在特定目录中运行。

    总而言之,我使用用户权限运行了这个命令(输入了登录密码):

    strace -o /tmp/strace3.log -f -e trace=file ecryptfs-mount-private`
    

    部分/tmp/strace3.log文件内容:

    ...
    4137  open("/lib/x86_64-linux-gnu/libnss_nis.so.2", O_RDONLY|O_CLOEXEC) = 3
    4137  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
    4137  open("/lib/x86_64-linux-gnu/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3
    4137  open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
    4137  open("/home/user/.ecryptfsrc", O_RDONLY) = -1 ENOENT (No such file or directory)
    4137  open("/home/user/.ecryptfs/wrapped-passphrase", O_RDONLY) = -1 EACCES (Permission denied)
    4137  open("/etc/localtime", O_RDONLY|O_CLOEXEC) = 3
    4137  +++ exited with 1 +++
    4112  --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=4137, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
    ...
    

    正如我们现在所看到的,ecryptfs-mount-private实用程序无法访问用户的wrapped-passphrase文件,从而导致Permission denied消息。

    检查/home/user/.ecryptfs/wrapped-passphrase文件的权限,它们是:

    -rw------- 1 root root
    

    将此文件的所有者通过更改sudo chown user:user /home/user/.ecryptfs/wrapped-passphrase为用户并在ecryptfs-mount-private没有 strace(输入登录密码)的情况下重新运行上述()命令,导致成功消息:

    INFO: Your private directory has been mounted.
    INFO: To see this change in your current shell:
      cd: /home/user
    
    • 1
  2. Best Answer
    Xen2050
    2019-01-15T23:29:25+08:002019-01-15T23:29:25+08:00

    我设置了一个 ecryptfs 私人文件夹,然后从包装密码文件中删除了 r & w 权限以进行测试...如果您在看到消息后立即检查了系统日志

    Info: Check the system log for more information from libecryptfs
    

    你会看到这样的行:

    1 月 15 日 00:21:48 sys ecryptfs-insert-wrapped-passphrase-into-keyring:无法检测包装的密码版本:权限被拒绝
    1 月 15 日 00:21:48 sys ecryptfs-insert-wrapped-passphrase-into-keyring:错误试图从文件 [/home/user/.ecryptfs/wrapped-passphrase]中解开密码短语;rc = [-13]

    这些将是一个非常强大的箭头,指向检查 ~/.ecryptfs/wrapped-passphrase 文件的权限。(不需要 sudo 或 strace)

    总而言之,只需确保您正在ecryptfs-mount-private以尝试挂载的同一用户目录运行命令,并且wrapped-passphrase文件具有-rw-------或(600)权限以及与加密目录相同的所有者。

    • 1

相关问题

  • 阻止挂载系统调用

  • 验证bash脚本中的密码哈希?

  • 将局域网硬盘挂载到 linux fedora

  • ssh-copy-id 成功,但还是提示输入密码

  • 使 mysql CLI 以交互方式向我询问密码

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve