Skip to content

Instantly share code, notes, and snippets.

@Linuxpizi
Created November 24, 2020 09:37
Show Gist options
  • Save Linuxpizi/039e2f729632edbf87d3f6a0f29f122b to your computer and use it in GitHub Desktop.
Save Linuxpizi/039e2f729632edbf87d3f6a0f29f122b to your computer and use it in GitHub Desktop.
ssh 禁止密码登录
sed -i "s/^PasswordAuthentication.*/PasswordAuthentication no/g" /etc/ssh/sshd_config
sed -i "s/^#RSAAuthentication.*/RSAAuthentication yes/g" /etc/ssh/sshd_config
sed -i "s/^#PubkeyAuthentication.*/PubkeyAuthentication yes/g" /etc/ssh/sshd_config
sed -i "s/^#AuthorizedKeysFile.*/AuthorizedKeysFile .ssh\/authorized_keys/g" /etc/ssh/sshd_config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment