aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xadd-authorized-keys6
1 files changed, 5 insertions, 1 deletions
diff --git a/add-authorized-keys b/add-authorized-keys
index bc4d86b..212c277 100755
--- a/add-authorized-keys
+++ b/add-authorized-keys
@@ -75,6 +75,10 @@ fi
### Install the key(s)
tmp=$(mktemp)
+cleanup(){
+ rm -f $tmp
+}
+trap "cleanup" 1 2 3 13 15
if [ "$readonly" = yes ] ; then
echo -n "command=\"read-only\" " > $tmp
fi
@@ -82,4 +86,4 @@ cat $rsaid >> $tmp
home=$(getent passwd $user | cut -f6 -d:)
cat $tmp >> $home/.ssh/authorized_keys
-rm $tmp
+cleanup