Disable host based ssh authentication

This commit is contained in:
Bob Mottram 2017-06-26 13:13:39 +01:00
parent a1f962b992
commit 2763247509
1 changed files with 6 additions and 0 deletions

View File

@ -40,6 +40,12 @@ function configure_ssh {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then if [[ $(is_completed $FUNCNAME) == "1" ]]; then
return return
fi fi
if ! grep 'HostbasedAuthentication' /etc/ssh/sshd_config; then
echo 'HostbasedAuthentication no' >> /etc/ssh/sshd_config
else
sed 's|#HostbasedAuthentication.*|HostbasedAuthentication no|g' /etc/ssh/sshd_config
sed 's|HostbasedAuthentication.*|HostbasedAuthentication no|g' /etc/ssh/sshd_config
fi
sed -i 's|#IgnoreRhosts.*|IgnoreRhosts yes|g' /etc/ssh/sshd_config sed -i 's|#IgnoreRhosts.*|IgnoreRhosts yes|g' /etc/ssh/sshd_config
sed -i 's|IgnoreRhosts.*|IgnoreRhosts yes|g' /etc/ssh/sshd_config sed -i 's|IgnoreRhosts.*|IgnoreRhosts yes|g' /etc/ssh/sshd_config
sed -i "s/Port .*/Port $SSH_PORT/g" /etc/ssh/sshd_config sed -i "s/Port .*/Port $SSH_PORT/g" /etc/ssh/sshd_config