Commit 8f4a8b7a authored by rohieb's avatar rohieb
Browse files don't overwrite authorized_keys on failure

This leads to inconsistent data.
parent e81300d1
/home/pi/stratumkey/ > /home/stratumkey/.ssh/authorized_keys
set -e
tmpfile="$(mktemp /tmp/stratumkey-genauth.XXXX)"
if ! /home/pi/stratumkey/ > $tmpfile; then
exit 127
cat -- "$tmpfile" > /home/stratumkey/.ssh/authorized_keys
wc -l /home/stratumkey/.ssh/authorized_keys
for file in $FILES
......@@ -8,3 +17,4 @@ do
sed 's/.pub//' <<< $(basename $file) > "/home/pi/stratumkey/keys/names/$(ssh-keygen -lf ${file} | awk '{ print $2 }')"
rm -- $tmpfile
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment