NameSilo

GUIDE: How to help prevent SSH attacks

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch
Hi all,

i thought i would share this guide with everyone. I created it to help people in securing their SSH connection. I will hopefully be adding a second part on other security methods soon.

How to help prevent SSH attacks

Enjoy!

Rick
 
Last edited:
4
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Just to add to what you have there (which was good :) ) you should really move SSH off the main IP as well
 
1
Close
Great little TuT there Ricky, good advice and nice step by step.

Nice Add by ethix as well.

Both rep'd.

Cyberian
 
0
Close
Thanks guys - and yes; its always a good idea to move SSH off the main IP, and if possible instead (or as well as) passwords, use IP detection (i.e only let your IP login).

I plan on doing a second part which will focus more on server security as a whole rather than just SSH.

Rick
 
0
Close
Your way is good, but I also do it this way. To effectively secure your ssh even further, you need to do:

vi /etc/ssh/sshd_config

1) change the #Protocol 2,1 to Protocol 2 (remember to remove the remark since it's a comment)
2) change the PermitRootLogin yes to PermitRootLogin no
3) change the PermitEmptyPasswords no to PermitEmptyPasswords no
4) change Banner /some/path to Banner /etc/issue
 
0
Close
Thanks cool guide
 
0
Close
nice
rep added

Joe
 
0
Close
Hmm, nice tutorial, but no mention of firewalling the SSH port (iptables) or even using the hosts.deny and hosts.allow files to deny/allow access to individual IP's.

Perhaps extend it to cover those too?
 
0
Close
I plan on adding a second part which will cover firewalls :tu: as well as other methods of securing your server.

Rick
 
0
Close
Hello,

I have done most of these things but I am curious as to know if it is working. I took a new server and installed BFD and changed the SSH port (plus other things) but I dont know if it is working. On all my other servers I get about 3-5 emails each a day from BFD saying it is working. But I have gotten no emails from the new one that has SSH on a different port. Can I check to see if it is working just by using the wrong password to log in on the new port? I dont know if I am not getting email because something is not set up right with it or if moving it to a different port has that much of an effect.
 
0
Close
gemcotechnologies said:
Hello,

I have done most of these things but I am curious as to know if it is working. I took a new server and installed BFD and changed the SSH port (plus other things) but I dont know if it is working. On all my other servers I get about 3-5 emails each a day from BFD saying it is working. But I have gotten no emails from the new one that has SSH on a different port. Can I check to see if it is working just by using the wrong password to log in on the new port? I dont know if I am not getting email because something is not set up right with it or if moving it to a different port has that much of an effect.

You aren't getting any warnings to let you know BFD is working, BECAUSE you've changed the SSH port.

Most automated scanners out there looking to crack SSH are going to check on the default port (22), and obviously won't check the others as it's a waste of time. Because you changed port, these scanners aren't hitting your SSH and as a result you're not getting the warnings.

Yes, you can try logging in manually with an incorrect password and this should flag up a warning.
 
0
Close
Yep,

as Echelon17 stated. Once you've moved the port you are likely to get very few if any access attempts on the new port as its all done through use of automated bots that spend hours trying to crack the password.
 
0
Close
Rep added.
Bookmarked the link in del.icio.us

Why don't you submit it in digg?
 
0
Close
Never really thought about that :p

Will do it now though...thanks for the suggestion :tu:
 
0
Close
Nice step-by-step tutorial.

Thanks for sharing.

Rpd!
 
0
Close
Repped however on Debian Sarge it was /etc/init.d/ssh restart :hehe:
Great job!
 
0
Close
if you really paranoid about your ssh, then move to key based authentication on the top of moving ssh to another port AND ip
 
0
Close
Its not a case of being paranoid....its a case of common sense ;)

key based authentication isn't something that most people require....its a good way to secure it....but not a must have.
 
0
Close
Great Guide!
 
0
Close
Thanks :)
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back