Last active
April 1, 2020 17:41
-
-
Save JorgeFrancoIbanez/9d6b75ffe6648de4cad32226b29062c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for i in $(grep "^[^#;]" /etc/ssh/sshd_config); do | |
echo $i | |
for s in ChallengeResponseAuthentication PasswordAuthentication PermitRootLogin X11Forwarding GSSAPIAuthentication;do | |
echo $s | |
if [[ $i == "$s"* ]]; then | |
echo $i; | |
echo $s; | |
sed -i "s/$s .*/$s no/g" /etc/ssh/sshd_config; | |
fi; | |
done; | |
done | |
for i in $(grep "^[#]" /etc/ssh/sshd_config); do | |
for s in ChallengeResponseAuthentication PasswordAuthentication PermitRootLogin X11Forwarding GSSAPIAuthentication;do | |
if [[ $i == "#$s"* ]]; then | |
sed -i "s/#$s .*/$s no/g" /etc/ssh/sshd_config; | |
fi; | |
done; | |
done | |
sed -i "s/UsePAM .*/UsePAM yes/g" /etc/ssh/sshd_config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment