diff options
author | Rafael Laboissière <rafael@laboissiere.net> | 2022-12-11 16:11:55 +0100 |
---|---|---|
committer | Rafael Laboissière <rafael@laboissiere.net> | 2022-12-11 16:15:33 +0100 |
commit | 53ea7c9e27ee817a4e2f8f5989bcc488a530e6b8 (patch) | |
tree | ccba49c380263ac091bcd067f8f5a13a2b5317cf | |
parent | f8e6e5a50e1a2462724cc9db0237f88351b11c50 (diff) |
add-authorized-keys: Exit gracefully
-rwxr-xr-x | add-authorized-keys | 6 |
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 |