First sync

This commit is contained in:
BrainwreckedTech
2019-08-23 20:31:57 -04:00
parent a9c6248b05
commit c80dca759c
10 changed files with 223 additions and 1 deletions

31
sshdpw Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env sh
[ ! "$(id -u)" -eq 0 ] && echo "Run as superuser." && exit 1
case "${1}" in
"on"|"enable"|"unlock")
FROM=yes; TO=no;
;;
"off"|"disable"|"lock")
FROM=no; TO=yes;
;;
"toggle")
if grep -q '^PasswordAuthentication yes' /etc/ssh/sshd_config; then
FROM=yes; TO=no;
else
FROM=no; TO=yes;
fi
;;
esac
for OPTION in PasswordAuthentication ChallengeResponseAuthentication; do
sed -i "s/#* *${OPTION} *${FROM}/${OPTION} ${TO}/g; w /dev/stdout" /etc/ssh/sshd_config
done
if command -v systemctl > /dev/null; then
systemctl restart sshd
elif [ -x /etc/init.d/sshd ]; then
/etc/init.d/sshd restart
else
echo "Restart SSH server to have changes take effect."
fi