From 6d3f981c30aea597abc1a73e80d90bce69639a37 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 23 Sep 2014 19:02:47 +0100 Subject: [PATCH] Use entire ssh directory --- install-freedombone.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/install-freedombone.sh b/install-freedombone.sh index 5d7a350f..fc54920c 100755 --- a/install-freedombone.sh +++ b/install-freedombone.sh @@ -165,15 +165,14 @@ function search_for_attached_usb_drive { if [ -f /media/usb/public_key.gpg ]; then MY_GPG_PUBLIC_KEY=/media/usb/public_key.gpg fi - if [ -f /media/usb/id_rsa ]; then - cp /media/usb/id_rsa /home/$MY_USERNAME/.ssh/id_rsa - chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh/id_rsa - # for security delete the private key from the usb drive - shred -zu /media/usb/id_rsa - fi - if [ -f /media/usb/id_rsa.pub ]; then - cp /media/usb/id_rsa.pub /home/$MY_USERNAME/.ssh/id_rsa.pub - chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh/id_rsa.pub + if [ -d /media/usb/.ssh ]; then + cp -r /media/usb/.ssh /home/$MY_USERNAME/.ssh + chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh + # for security delete the ssh keys from the usb drive + shred -zu /media/usb/.ssh/id_rsa + shred -zu /media/usb/.ssh/id_rsa.pub + shred -zu /media/usb/.ssh/known_hosts + rm -rf /media/usb/.ssh fi fi echo 'search_for_attached_usb_drive' >> $COMPLETION_FILE