Skip to content
Permalink
Browse files

Add key pair to new user on init

  • Loading branch information...
NEMS Linux
NEMS Linux committed Aug 24, 2019
1 parent 9ed5c3b commit 210fdf9f011349f68852c9b3d2ac4c89721738a3
Showing with 8 additions and 0 deletions.
  1. +8 −0 init.sh
@@ -217,6 +217,14 @@ else
if [[ $platform == 22 ]]; then
echo Configuring Amazon Web Services default user
/bin/sed -i -- 's/nemsadmin/'"$username"'/g' /etc/cloud/cloud.cfg
# Amazon Web Services uses a key pair instead of password
if [[ -e /home/nemsadmin/.ssh/authorized_keys ]]; then
if [[ ! -e /home/$username/.ssh ]]; then
mkdir /home/$username/.ssh
fi
cp /home/nemsadmin/.ssh/authorized_keys /home/$username/.ssh/
chown $username:$username /home/$username/.ssh/authorized_keys
fi
echo Done.
fi

0 comments on commit 210fdf9

Please sign in to comment.
You can’t perform that action at this time.