Information Security Stack Exchange is a question and answer site for information security professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Invalid users trying to log in to my server

I have a small ssh server mostly used for file sharing. A couple of other people and I use it and there are only 3 users. Recently I checked the auth.log file and there was a ridiculous amount of logins from a set of hosts with different usernames. I think I'm being hacked by something like hydra and I'm not sure what to do. I put a slice of the log file on pastebin:

I took some info out of the file for securities sake but everything you need to see is there. None of these usernames ring a bell nor does the ip.

share|improve this question

marked as duplicate by Jeff Ferland Dec 12 '12 at 3:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Welcome to our site! Hopefully the answers in the duplicate question I linked are helpful to you. We see this a lot, but since people ask the question in various different ways, it can sometimes be hard to find the right answer in the haystack. – Jeff Ferland Dec 12 '12 at 3:34

I don't think your server is being attacked very effectively, if it's the usual "guess root account password" moronic attack. That attack just won't work if you have sshd configured at all securely (with PermitRootLogin no).

If you're comfortable with C-language coding, you can make a "tarpit" out of sshd by following these instructions. The last time I did that, I set up my SSH server to delay for 7 seconds on an incorrect password. I didn't do exactly as the instructions said, but it was pretty close. Anyway, on a bad password, sshd sleeps for some seconds, which really puts a dent in the cycles those password guessers can sap, as they send requests sequentially, and single-threaded.

If we all set up our SSH servers this way, SSH password guessing will go the way of the dinosaur.

share|improve this answer

Welcome to the Internet. There are hundreds and thousands of hosts probing for SSH servers and attempting to brute force them daily. You are no different. There are a few things you can do to protect yourself.

First, turn off password-based logins if at all possible. Using only public-key authentication will completely stop password brute-forcing. If you must use password-based authentication, then make sure you have no default accounts/passwords, disable root login, and enforce password complexity with something like passwdqc or pam_cracklib.

Second, use fail2ban to monitor bad logins and temporarily ban offenders. Temporary bans are better than permanent, since you may accidentally lock yourself out, and permanent bans will clutter up your firewall rules.

share|improve this answer

It does look like it. With the quantity , timing and all the usernames being generic defaults. If they are all coming from the same ip, like it appears in the bit of logs on pastebin, you could just block that ip.

share|improve this answer
How exactly would I do that? – smithy545 Dec 12 '12 at 1:41

I just came to know there is a package that serves this purpose:

Note that this is not 'Live'. It looks at the log files and then blocks that particular IP. In your case, this would work.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.