Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 1.59 KB

File metadata and controls

49 lines (33 loc) · 1.59 KB

Disable SSH login for root user

Why?

  • Most of the automatic brute-force software starts with attacking SSH service on 22 port and try to match a password for the root user
  • root user is not the only user under risk, brute-force software has abundant dictionaries of most common used user-names, so it's a good idea to create a user with some random-gibberish name, like: QBHZEEQXT

Before you go:

Edit /etc/ssh/sshd_config file:

# nano /etc/ssh/sshd_config

# Find line starting with "PermitRootLogin"
# change "yes" to "no":
PermitRootLogin no

# Save file with: "ctrl + o" combination
# Close file with: "ctrl + x" combination

Add extra security layer, with limiting login only to a single user (optional):

# nano /etc/ssh/sshd_config

# Add new line, where [username]
# is the name of ONLY allowed to
# login over SSH user:
AllowUsers [username]

# Save file with: "ctrl + o" combination
# Close file with: "ctrl + x" combination

Restart SSH service:

service sshd restart

Further reading: