Skip to content

Commit

Permalink
ssh-conf
Browse files Browse the repository at this point in the history
  • Loading branch information
leaddevops authored Mar 30, 2024
1 parent 59f337d commit e14d6d0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/setupUser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit e14d6d0

Please sign in to comment.