Ownership of ssh directory
This commit is contained in:
parent
fa608871e3
commit
fcf6800422
|
@ -35,11 +35,13 @@ if [ "$SSH_PUBLIC_KEY" ]; then
|
||||||
if [ -f "$SSH_PUBLIC_KEY" ]; then
|
if [ -f "$SSH_PUBLIC_KEY" ]; then
|
||||||
mkdir /home/$MY_USERNAME/.ssh
|
mkdir /home/$MY_USERNAME/.ssh
|
||||||
cp $SSH_PUBLIC_KEY /home/$MY_USERNAME/.ssh/authorized_keys
|
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'
|
echo 'ssh public key installed'
|
||||||
else
|
else
|
||||||
if [[ "$SSH_PUBLIC_KEY" == "ssh-"* ]]; then
|
if [[ "$SSH_PUBLIC_KEY" == "ssh-"* ]]; then
|
||||||
mkdir /home/$MY_USERNAME/.ssh
|
mkdir /home/$MY_USERNAME/.ssh
|
||||||
echo "$SSH_PUBLIC_KEY" > /home/$MY_USERNAME/.ssh/authorized_keys
|
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'
|
echo 'ssh public key installed'
|
||||||
else
|
else
|
||||||
echo 'The second parameter does not look like an ssh key'
|
echo 'The second parameter does not look like an ssh key'
|
||||||
|
|
Loading…
Reference in New Issue