diff --git a/scripts/setupUser.sh b/scripts/setupUser.sh index 5f69a9b2..2405d897 100755 --- a/scripts/setupUser.sh +++ b/scripts/setupUser.sh @@ -70,6 +70,7 @@ update_conf() { sudofile="/etc/sudoers" sshdfile="/etc/ssh/sshd_config" + sshdconfd="/etc/ssh/ssh_config.d" mkdir -p /home/backup if [ -f $sudofile ];then cp -p $sudofile /home/backup/sudoers-$now @@ -85,7 +86,14 @@ update_conf() else echo "could not find $sudofile" fi - + if [ -d $sshdconfd ];then + if [ -f $sshdconfd/60-cloudimg-settings.conf ];then + sed -i '/PasswordAuthentication.*no/d' $sshdconfd/60-cloudimg-settings.conf + sed -i '/PasswordAuthentication.*yes/d' $sshdconfd/60-cloudimg-settings.conf + else + echo "$sshdconfd/60-cloudimg-settings.conf does not exist" + fi + fi if [ -f $sshdfile ];then cp -p $sshdfile /home/backup/sshd_config-$now sed -i '/ClientAliveInterval.*0/d' $sshdfile