summaryrefslogtreecommitdiff
path: root/src/utils/ecryptfs-umount-private
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/ecryptfs-umount-private')
-rwxr-xr-xsrc/utils/ecryptfs-umount-private26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/utils/ecryptfs-umount-private b/src/utils/ecryptfs-umount-private
new file mode 100755
index 0000000..28e0b08
--- /dev/null
+++ b/src/utils/ecryptfs-umount-private
@@ -0,0 +1,26 @@
+#!/bin/sh -e
+# This script unmounts a user's private ecryptfs folder
+# and clears the kernel keyring of the relevant keys
+#
+# Original by Michael Halcrow, IBM
+# Extracted to a stand-alone script by Dustin Kirkland <kirkland@ubuntu.com>
+
+TEXTDOMAIN="ecryptfs-utils"
+
+if grep -qs "$HOME/.Private $PWD ecryptfs " /proc/mounts 2>/dev/null; then
+ pwd_mounted=1
+fi
+if /sbin/umount.ecryptfs_private; then
+ for sig in `cat "$HOME/.ecryptfs/Private.sig"`; do
+ for key_id in `keyctl list @u | grep "$sig$" | awk -F: '{print $1}'`; do
+ keyctl unlink "$key_id" @u
+ done
+ done
+ if [ "$pwd_mounted" = "1" ]; then
+ echo
+ echo `gettext "INFO:"` `gettext "Your private directory has been unmounted."`
+ echo `gettext "INFO:"` `gettext "To see this change in your current shell:"`
+ echo " cd $PWD"
+ echo
+ fi
+fi