Security tip: avoid brute force attack via root ssh

Vuong Tran
Jan 20, 2017 · 1 min read

Disable logging into server as root through ssh now! Because any hacker can use brute force attach to attempt your root password and potentially get access into your server if they can figure out your password.

Original image url: The easiest hacking method — Brute force — Steemit

In this case, solution better is disable login as root and have a separate account that regular to use and simple sudo to root when necessary.

Follow step by step below to disable login root ssh. Befor you begin, make sure you have an account as root.

We will edit in file sshd_config, this is the main configuration file of sshd service.

# open file
$ vim /etc/ssh/sshd_config

Try to find this selection in the file, make the line look like this to disable logging in through ssh as root.

PermitRootLogin no

Finally you’ll need to restart sshd service, now nobody can brute force attach your server.

$ /etc/init.d/sshd restart
# or
$ service sshd restart

That’s it, happy coding!

Vuong Tran

Written by

Software Engineer / Ho Chi Minh City, Vietnam

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade