Check for ssh public key

This commit is contained in:
Bob Mottram 2015-10-31 20:26:00 +00:00
parent 74673601e9
commit 1713d292d1
1 changed files with 13 additions and 11 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
MY_USERNAME=$1
SSH_PUBLIC_KEY=$2
SSH_PUBLIC_KEY="$2"
GPG_KEYSERVER='hkp://keys.gnupg.net'
SSH_PORT=2222
COMPLETION_FILE=$HOME/freedombone-completed.txt
@ -30,7 +30,8 @@ if [ ! -d /home/$MY_USERNAME ]; then
exit 4
fi
if [ $2 ]; then
if [ "$SSH_PUBLIC_KEY" ]; then
if [ ${#SSH_PUBLIC_KEY} -gt 5 ]; then
if [ -f $SSH_PUBLIC_KEY ]; then
mkdir /home/$MY_USERNAME/.ssh
cp $SSH_PUBLIC_KEY /home/$MY_USERNAME/.ssh/authorized_keys
@ -46,6 +47,7 @@ if [ $2 ]; then
fi
fi
fi
fi
if [ ! -d /home/$MY_USERNAME/Maildir ]; then
echo 'Email directory was not created'