Solved

"last" command

Posted on 2004-08-08
3
267 Views
Last Modified: 2010-04-20
Dear Expert,
In the man page, last command will display all users login into the system since day one setup, however I found my system only display recent one month only, eventhough my system has been setup for years. Where to set to enable the system to track user login for longer period of time?
Thanks you in advance.
Linux Novice,
OMLoo
0
Comment
Question by:omloo
  • 2
3 Comments
 
LVL 4

Expert Comment

by:net_sec_guru
ID: 11749576
you can do a:

last -t <YYYYMMDDHHMMSS>

This will give you a list from that specified date. It gives status of all logins as of that time of date.

Is this what you're looking for?

0
 
LVL 20

Expert Comment

by:Gns
ID: 11751387
This is truncated in the logrotate subsystem, which is there to see to it that logfiles (and similar) don't grow to fill the hdd completely.
Look in the file /etc/logrotate.conf for mention of the wtmp file... Chances are great that you have a stanza like this:
# no packages own lastlog or wtmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
}
... which should be selfexplanatory more or less. Look at the manpage for logrotate where the fileformat is documented.

-- Glenn
0
 
LVL 20

Accepted Solution

by:
Gns earned 50 total points
ID: 11751431
Note that you could either remove it from the "logrotations", or set "rotate X" where X is the number of "old files" to keep. In the latter case you'd have /var/log/wtmp for the current month, /var/log/wtmp.1 for the previous month, /var/log/wtmp.2 for the month before that etc up to the total number of files == X. Then you could do "last -f /var/tmp/wtmp.1 ...".
The bad thing with wtmp files like that would be for sessions going "over the month edges", where it couldn't determine start/end of such a session (depending on which file you looked at).
But generally, this is viewed as no big deal:-).

-- Glenn
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

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.…
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

760 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

18 Experts available now in Live!

Get 1:1 Help Now