Ownership of ssh directory

This commit is contained in:
Bob Mottram 2015-11-01 10:03:26 +00:00
parent fa608871e3
commit fcf6800422
1 changed files with 2 additions and 0 deletions

View File

@ -35,11 +35,13 @@ if [ "$SSH_PUBLIC_KEY" ]; then
if [ -f "$SSH_PUBLIC_KEY" ]; then
mkdir /home/$MY_USERNAME/.ssh
cp $SSH_PUBLIC_KEY /home/$MY_USERNAME/.ssh/authorized_keys
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
echo 'ssh public key installed'
else
if [[ "$SSH_PUBLIC_KEY" == "ssh-"* ]]; then
mkdir /home/$MY_USERNAME/.ssh
echo "$SSH_PUBLIC_KEY" > /home/$MY_USERNAME/.ssh/authorized_keys
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
echo 'ssh public key installed'
else
echo 'The second parameter does not look like an ssh key'