Browse Source

Ownership of ssh directory

Bob Mottram 9 years ago
parent
commit
fcf6800422
1 changed files with 2 additions and 0 deletions
  1. 2
    0
      src/freedombone-adduser

+ 2
- 0
src/freedombone-adduser View File

@@ -35,11 +35,13 @@ if [ "$SSH_PUBLIC_KEY" ]; then
35 35
         if [ -f "$SSH_PUBLIC_KEY" ]; then
36 36
             mkdir /home/$MY_USERNAME/.ssh
37 37
             cp $SSH_PUBLIC_KEY /home/$MY_USERNAME/.ssh/authorized_keys
38
+            chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
38 39
             echo 'ssh public key installed'
39 40
         else
40 41
             if [[ "$SSH_PUBLIC_KEY" == "ssh-"* ]]; then
41 42
                 mkdir /home/$MY_USERNAME/.ssh
42 43
                 echo "$SSH_PUBLIC_KEY" > /home/$MY_USERNAME/.ssh/authorized_keys
44
+                chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
43 45
                 echo 'ssh public key installed'
44 46
             else
45 47
                 echo 'The second parameter does not look like an ssh key'