kit/other_scripts/sshd-limit-passwords.sh

15 lines
379 B
Bash
Executable File

#!/bin/bash
# Run this script with "(sudo) bash <filename> <args>".
# Exit on error.
set -e
# This is just a simple echo & a restart.
# NOTE: This will not stop passwords (for some users) if another config
# drop-in overrides it e.g, match group/users etc.
echo "PasswordAuthentication no" > \
/etc/ssh/sshd_config.d/10-PasswordAuthentication.conf
systemctl restart sshd