ecryptfs-recover-private fails to mount previous homedir on ubuntu bionic
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
eCryptfs |
New
|
Undecided
|
Unassigned |
Bug Description
# REPRODUCE:
Steps (specific real info replaced with vars):
1. Boot from Lubuntu 18.04 (bionic) daily-live (http://
2. Create user with the same uid as was used by previous home user ($user).
3. Logout & sign in as $user.
4. Mount *partition* with previous (ecryptfs-
5. Install ecryptfs utils (not on Lubuntu 18.04 live by default):
```bash
$ sudo apt update
$ sudo apt install ecryptfs-utils
```
6. Mount previous home:
```bash
$ sudo ecryptfs-
INFO: Found [$mnt/home/
Try to recover this directory? [Y/n]:
INFO: Found your wrapped-passphrase
Do you know your LOGIN passphrase? [Y/n]
INFO: Enter your LOGIN passphrase...
Passphrase:
Inserted auth tok with sig [$ecryptfs_sig] into the user session keyring
mount: /tmp/ecryptfs.
ERROR: Failed to mount private data at [/tmp/ecryptfs.
```
```bash
$ ls -ld /tmp/ecryptfs.
drwx------ 2 root root 40 May 5 17:04 /tmp/ecryptfs.
```
-------
(edited:)
# HOTFIX (HACK):
Steps (after $tmpdir creation but *before* trying to mount):
1. Change user and group ownership of temporary folder (to mount in) to the user (uid) and group (gid) of the previous (ecryptfs-
2. (HACK) Run the mount command that follows, but first without the '-i' parameter and submit empty password (enter) 3x.
# NOTES:
I don't exactly know why the hack is needed (probably to reset some state), but without this failed mount without '-i' cannot successfully mount afterwards.
When I had ecryptfs-
But if after a failed mount I ran only the mount command from the script without the '-i' parameter manually in a terminal then interrupted when asked the passphrase (by Ctrl+C), then the only-chmod-patched ecryptfs-
-> The hack step is needed only once per boot.
If patched with the hack, use empty passphrase as Ctrl+C will interrupt the whole script not just the mount command (as echo-ed in the patch).
I got the mount command (that failed, and had to fail without '-i') by running ecryptfs-
```bash
$ sudo sh -ex /usr/bin/
description: | updated |
description: | updated |
description: | updated |
description: | updated |
tags: | added: ecryptfs-utils |
tags: | added: ecryptfs-recover-private |
description: | updated |
description: | updated |
description: | updated |
# Patch
WHAT: "$mnt"/ home/.ecryptfs/ "$user" /.Private /tmp/ecryptfs. "$XXXXXXXX"
After mktemp, before mount:
```bash
chown --reference=
```
USE:
```bash
cd / && patch -p1 <"$patch_path"
```