Skip to content

Instantly share code, notes, and snippets.

@ChengLong
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChengLong/e5a3d8075b3e22b8df0b to your computer and use it in GitHub Desktop.
Save ChengLong/e5a3d8075b3e22b8df0b to your computer and use it in GitHub Desktop.
[ssh] Disable PermitRootLogin and PasswordAuthentication

To make your server more secure, it's a good idea to disable root login and password authentication.

Open /etc/ssh/sshd_config

  1. Make sure ssh with pub key is enabled
RSAAuthentication yes
PubkeyAuthentication yes
  1. Disable PermitRootLogin

Before doing this, make sure you have created other user(s) who have sudo. Otherwise, no user has sudo...

PermitRootLogin no
  1. Disable PasswordAuthentication
PasswordAuthentication no
  1. Restart ssh

sudo service ssh restart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment