Skip to content
Permalink
Browse files

Fix position of ssh key move

  • Loading branch information...
NEMS Linux
NEMS Linux committed Aug 24, 2019
1 parent f7730e7 commit 7327223422446671389b74425385171bcac71677
Showing with 14 additions and 16 deletions.
  1. +14 −14 init.sh
  2. +0 −2 platforms/aws/nemsadmin-pw.sh
28 init.sh
@@ -214,20 +214,6 @@ else
/bin/sed -i -- 's/nemsadmin/'"$username"'/g' /etc/samba/smb.conf
systemctl restart smbd

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
mv /home/nemsadmin/.ssh/authorized_keys /home/$username/.ssh/
chown $username:$username /home/$username/.ssh/authorized_keys
fi
echo Done.
fi

echo Initializing new Nagios user
systemctl stop $nagios

@@ -369,6 +355,20 @@ service.rpi-monitor=0
echo "Done."
fi

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 -p /home/$username/.ssh
fi
mv /home/nemsadmin/.ssh/authorized_keys /home/$username/.ssh/
chown $username:$username /home/$username/.ssh/authorized_keys
fi
echo Done.
fi

# Disable the initial admin account
if [[ -d /home/$username ]] && [[ -d /home/nemsadmin ]]; then
# nemsadmin user will be deleted automatically via cron now that you're initialized, but this stuff is just to protect users in case for some reason the nemsuser user remains.
@@ -1,7 +1,5 @@
#!/bin/bash



if [ -d /home/nemsadmin ]; then # the nemsadmin user folder exists
usercount=$(find /home/* -maxdepth 0 -type d | wc -l)

0 comments on commit 7327223

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