Last active
August 6, 2019 16:34
-
-
Save JorgeFrancoIbanez/f35e41cb8fdca40d752ac3f0f0d5a1eb to your computer and use it in GitHub Desktop.
SSH KEY cOnfuiguration for only ssh access
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;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;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