Solved

Linux Logging - User Login Attempts

Posted on 2000-03-03
11
431 Views
Last Modified: 2013-12-16
Hello,
  Over the last several days, I have had a hacker breach security on a linux box and use it as a mail relay.  I found out how he did it, the news account was left open for all to see.  What I was wanting to know is this:

Does linux log all login attempts? Where?

When it logs these attempts, does it log the IP address that the attempt was coming from?  Where?

If not.. how can I make it do these things.


Thanks!

0
Comment
Question by:kittlej
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 3

Expert Comment

by:jyu_88
ID: 2580592
use the command 'last' to check users login history (telnet, ftp, ssh, etc.) since last reboot. It is parsing /var/log/wtmp.
jyu      ftp          bac.bogus.com Thu Mar  2 18:30 - 18:31  (00:00)    
jyu      ftp          bac.bogus.com Thu Mar  2 18:30 - 18:30  (00:00)    
jyu      ftp          bac.bogus.com Thu Mar  2 18:28 - 18:29  (00:01)    
jyu      ftp          bogus.bogus.co Thu Mar  2 18:07 - 18:07  (00:00)    
jyu      pts/1        bogus.remote.com. Thu Mar  2 17:45 - 17:48  (00:02)    
jyu      pts/0        server1.bogus.com Thu Mar  2 16:53 - 18:38  (01:44)    
..................morehere.............
0
 
LVL 1

Author Comment

by:kittlej
ID: 2580706
What about failed attempts?
0
 
LVL 1

Author Comment

by:kittlej
ID: 2580746
What about failed attempts?
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2580875
Syslog logs all login access, successful and failed attempts in the /var/log/message* files. Failed sessions show the username tried and the reason for failure. Since the syslog data goes back further in time, it's a better way of lookin at access, but it won't give you the remote IP.
0
 
LVL 1

Author Comment

by:kittlej
ID: 2580890
But is there a way that I can set it up so that every login attempt - successful or failed - is logged to a file with the ip address of the user?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 40

Expert Comment

by:jlevie
ID: 2581046
I don't think so with native facilities, but I'll see what I can find for you.
0
 
LVL 2

Expert Comment

by:bernardh
ID: 2581101
i'm not sure if linux has some kind of utility like iptrace/ipreport of aix but  there is a linux utility from
www.bandmin.org called bandmin that i believe does ip tracing. check it out.
0
 
LVL 2

Expert Comment

by:bernardh
ID: 2582147
by the way, have you tried the lastlog command? it shows what username was used, the port number as well as the hostname of the culprit, try it.
0
 
LVL 8

Expert Comment

by:stefanx
ID: 2582761
For telnet attempts, just grep telnet from you /var/log/syslog file...
0
 
LVL 40

Accepted Solution

by:
jlevie earned 50 total points
ID: 2583250
Hmm, everyone has been focused on the exact guestion (including myself) and has ingnored the more basic issue.

While it would be nice to have a log of of all login attempts that included the IP, there can be other ways for an attacker to penetrate a Unix system. You might want to take a look at http://www.sans.org/newlook/projects/bastille_linux.htm and at the Security HowTo.
0
 
LVL 1

Author Comment

by:kittlej
ID: 2587286
Thanks to all who helped in this question, I'm awarding the points to jlevie because he had the most useful information, but I wish to accredit all of you who participated, as you have each helped in your own way.  Thanks!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now