Needs simple script to unencrypt private home

Bug #1195399 reported by TJ
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ecryptfs-utils (Ubuntu)
Confirmed
Wishlist
Unassigned

Bug Description

Ubuntu 13.04 Raring amd64

It would be useful if, as well as the (inconvenient) instructions for un-encrypting a user's home directory:

ecryptfs-setup-private --undo

that the package includes a new tool:

ecryptfs-unencrypt-home

Needing this recently I created the attached shell script.

It can be used by the user whilst logged in and using the encrypted folder from a console TTY terminal or ssh session. Currently it might cause issues for GUI sessions that maintain open files/sockets in the home directory.

Revision history for this message
TJ (tj) wrote :
Revision history for this message
TJ (tj) wrote :
Download full text (4.2 KiB)

If you wish to test this script here's the procedure.

1. Download and install
2. Give execute permissions
3. Create a test user account
4. Log-in as the test user
5. Run the script
6. Log-out/in/out as test user
7. Delete the test user account

# Download and install
$ wget -O - https://bugs.launchpad.net/ubuntu/+source/ecryptfs-utils/+bug/1195399/+attachment/3716219/+files/ecryptfs-unencrypt-home | sudo dd of=/usr/local/bin

# Give execute permissions
$ sudo chmod a+x /usr/local/bin/ecryptfs-unencrypt-home

# Create a test user account
$ sudo adduser --encrypt-home test_e

# Log-in as the test user
$ su -l test_e

test_e@ubuntu:~$

# Run the script. It will check whether /home/ is on a separate file-system
test_e@ubunut:~$ ecryptfs-unencrypt-home
Found a separate /home/ file-system
[sudo] password for test_e:
Some commands in this script (mount) will request 'sudo' privileges.
Sorry, user test_e may not run sudo. Please use an account with privileges to run the following commands and then re-run this script:
sudo mkdir -p /tmp/mnt/home
sudo mount /dev/mapper/Ubuntu-Home /tmp/mnt/home

# At this point the script has determined that the user doesn't have mount permissions and requires another user account to perform these steps. At another terminal using a sudo-privileged account follow the instructions:

$ sudo mkdir -p /tmp/mnt/home
$ sudo mount /dev/mapper/Ubuntu-Home /tmp/mnt/home

# And now, at the test_e session, re-run the script. It will check the mount has been performed before continuing:

test_e@ubuntu:~$ ecryptfs-unencrypt-home
Found a separate /home/ file-system
[sudo] password for test_e:

Contents of the new, unencrypted home, are currently:
total 8
dr-x------ 2 test_e test_e 4096 Jun 27 18:33 .
drwxr-xr-x 8 root root 4096 Jun 27 18:33 ..
lrwxrwxrwx 1 test_e test_e 56 Jun 27 18:33 Access-Your-Private-Data.desktop -> /usr/share/ecryptfs-utils/ecryptfs-mount-private.desktop
lrwxrwxrwx 1 test_e test_e 32 Jun 27 18:33 .ecryptfs -> /home/.ecryptfs/test_e/.ecryptfs
lrwxrwxrwx 1 test_e test_e 31 Jun 27 18:33 .Private -> /home/.ecryptfs/test_e/.Private
lrwxrwxrwx 1 test_e test_e 52 Jun 27 18:33 README.txt -> /usr/share/ecryptfs-utils/ecryptfs-mount-private.txt

Copying encrypted home files to unencrypted location, this may take some time...
sending incremental file list
./
.bash_logout
.bashrc
.profile
examples.desktop

sent 13859 bytes received 91 bytes 27900.00 bytes/sec
total size is 13537 speedup is 0.97

Switching to the unencrypted home...

INFO: Your private directory has been unmounted.
INFO: To see this change in your current shell:
  cd /home/test_e

...done.

Moving but preserving the .ecryptfs links (in case you want to reverse the process)
ecryptfs links are now in /home/test_e/.ecryptfs-home/

Your unencrypted files have not been deleted from /home/.ecryptfs/test_e
If you really want to delete them (and the .ecryptfs links) re-run this script with:
ecryptfs-unencrypt-home --really-delete-encrypted-files

Sorry, user test_e may not run sudo. Please use an account with privileges to run the following commands:
sudo umount /tmp/mnt/home
sudo rmdir /tmp/mnt/home
sudo rmdir /tmp/mnt
Finished.

# Log-out from t...

Read more...

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ecryptfs-utils (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.