commit 130c98f1fe72a117b3a9247d138c932dea572c82
parent 41738e762671b1114fe9a1e40bd0aae924801827
Author: Jaromil <jaromil@dyne.org>
Date:   Tue, 24 May 2011 11:17:33 +0200
correctly set ownership to user on newly created tombs
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/tomb b/src/tomb
@@ -441,8 +441,9 @@ create_tomb() {
     losetup -d ${nstloop}
 
     # set permissions on the tomb
-    sudo chown $UID:$GID ${tombfile}
-    sudo chmod 600 ${tombfile}
+    ME=${SUDO_USER:-$(whoami)}
+    chmod 0600 ${tombfile}
+    chown $(id -u $ME):$(id -g $ME) ${tombfile}
 
     act "done creating $tombname encrypted storage (using Luks dm-crypt AES/SHA256)"
     notice "Your tomb is ready in ${tombdir}/${tombfile} and secured with key ${tombfile}.key"