Shell: Search in logs

CLI fundamentals
Last update: 13 Sep 22:59
1
Student

solution

The logs directory includes an access.log file, which stores the logs for server connection. You need to find the possible hacking attempts in this file.

02.01.2021 05:33:50 localhost ssh: denied wrong password from 156.78.198.42
02.01.2021 06:28:29 localhost ssh: successfully authenticated from 108.117.162.5
02.01.2021 07:27:32 localhost ssh: successfully logged out from 254.199.78.117
02.01.2021 11:24:56 localhost ssh: connection dropped by timeout from 227.65.89.157
02.01.2021 11:59:29 localhost ssh: denied wrong password from 252.175.99.156
02.01.2021 12:17:44 localhost ssh: connection dropped by timeout from 50.26.154.246

In the solution file write a command to find lines containing "denied wrong password" in the access.log file; sort them in a reverse order and print the five most recent entries.

For full access to the challenge you need a professional subscription.

A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.

Get access
130
courses
1000
exercises
2000+
hours of theory
3200
tests