18

This question already has an answer here:

Trying to find out why fail2ban is not working.

Where does Ubuntu 14.04 log SSH access attempts?

marked as duplicate by Exeleration-G, Eliah Kagan, Zanna, Kevin Bowen, earthmeLon Jan 28 '17 at 0:18

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.

  • You could ask rsyslogd which files it logs to: cat /etc/rsyslog.d/* | egrep -v '^#|^$' | egrep -o '/[^ ]+' on your system. – waltinator Jun 25 '15 at 19:04
15

All login attempts are logged to /var/log/auth.log

Search for brute-force SSH logins

Run this command:

grep sshd.\*Failed /var/log/auth.log | less

Search for failed connections

Run this command:

grep sshd.*Did /var/log/auth.log | less

UPDATE:

You should try restarting the syslog daemon to see if it starts to log to the correct file.

sudo service rsyslog restart

Once you have messages going to the auth.log it should start working.

  • 1
    I looked in /var/log/auth.log and the file is empty and nothing is being logged to it... – timbram Jun 25 '15 at 16:00
  • check the update – Maythux Jun 25 '15 at 16:03
  • Ok, just restarted rsyslog. Then logged out, tried to log in with a few wrong passwords. Then went ahead and logged in properly. Still nothing logged to auth.log. – timbram Jun 25 '15 at 16:09
  • What do you think I should look at next? – timbram Jun 25 '15 at 16:10
  • I noticed that in /var/log the username that I use (my non-root user) is the owner of a lot of these files. Could that be the problem do you think? – timbram Jun 25 '15 at 16:12
2

The default log settings for ssh are "INFO".

If you want to have it include login attempts in the log file, you'll need to edit the /etc/ssh/sshd_config file and change the "LogLevel" from INFO to VERBOSE.

After that, restart the sshd daemon with

sudo service rsyslog restart

After that, the ssh login attempts will be logged into the /var/log/auth.log file.

  • Thanks for the formatting clarifications. I'll look for how to do that next time I put in an answer. – Shay Walters Dec 20 '16 at 19:40

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