Unixery & daemon worship 🔥


It's a Unix system! I know this!

SSH Passwort-Login in FreeBSD abschalten

Mit folgenden kleinen Skript lässt sich in FreeBSD der SSH Passwort-Login abschalten:

#!/bin/sh
# tweak ssh settings

# allowed authentication methods
for SSH_YES in PubkeyAuthentication UsePAM; do
    sed -i '' -e "s/^#${SSH_YES}\ /${SSH_YES} /" -e "s/^${SSH_YES}\ .*/${SSH_YES} yes/" /etc/ssh/sshd_config
done

# not allowed authentication methods
for SSH_NO in PasswordAuthentication ChallengeResponseAuthentication KbdInteractiveAuthentication; do
    sed -i '' -e "s/^#${SSH_NO}\ /${SSH_NO} /" -e "s/^${SSH_NO}\ .*/${SSH_NO} no/" /etc/ssh/sshd_config
done

# restart service
service sshd restart