From e14d6d0e5c1f7d8fb9b9033d6f0218fd2eb795b9 Mon Sep 17 00:00:00 2001 From: leaddevops <36464863+leaddevops@users.noreply.github.com> Date: Sat, 30 Mar 2024 15:57:00 +0530 Subject: [PATCH] ssh-conf --- scripts/setupUser.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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