02-06-2008
>how to find last login time of a user in faster way if wtmps size is too large??
I though your question was the last login of A user, in such case my command to type should not take more than 4 seconds at the most or you have some trouble (the longest delay I got so far was 1.5!)
I did not say to type last, as this will display all the successfull attempt of all the users since the origin of wtmp, but last <your user name>| head -1 (the first line: the last login) or whatever lines you need or as suggested: last -1 <username> which would be faster still...
Here are some records:
ant:/var/spool/cron/crontabs $ timex last|wc -l
real 16.32
user 9.40
sys 1.55
182882
ant:/var/spool/cron/crontabs $ timex last vbe|head -1
vbe pts/1 Thu Jan 31 16:26 - 16:33 (00:06)
real 0.42
user 0.19
sys 0.08
ant:/var/spool/cron/crontabs $ timex last -1 vbe
vbe pts/1 Thu Jan 31 16:26 - 16:33 (00:06)
real 0.03
user 0.01
sys 0.01
With 182882 records it replies (almost) instantly...
No doubt last -1 name is the fatest...
I suggest that you resize wtmp at something reasonable if it is giving you trouble... ( save a copy before for archive history... since you can use last specifying a filename also! great no?)
If you have may users you want the information write a script that read the list of names
All the best
8 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi,
I am trying to attach tape drive to sun V890 running Solaris 9 on it.
I have installed HBA(qlogic) in slot 1 of 0-8 slots and booted the system. I do not see HBAin prtdiag output. The tape drive is not attached to HBA. The tape drive I am going to attach is Sony AIT3.
1.How can I make... (3 Replies)
Discussion started by: sriny
3 Replies
2. Web Development
Hello,
I have created a web page on a server using apache and added .htaccess and .htpasswd in the folder for authentification.
I was wondering if there was anyway to tie-in the login for this page with the login used to logon to the server.
i.e. the same login info. is used for both,... (2 Replies)
Discussion started by: WhotheWhat
2 Replies
3. Cybersecurity
Hello,
I have created a web page on a server using apache and added .htaccess and .htpasswd in the folder for authentification.
I was wondering if there was anyway to tie-in the login for this page with the login used to logon to the server.
i.e. the same login info. is used for both, when... (1 Reply)
Discussion started by: WhotheWhat
1 Replies
4. Solaris
Hello World ~
HW : SUN Fire V240
OS : Solaris 8
Error message prompts 'rmclomv ... SC login failure ...' on terminal.
and
Error Message prompts continually 'SC Login Failure for user Please login:' on Single Mode(init S)
The System is in normal operation, though
In case of rain, Can... (1 Reply)
Discussion started by: lifegeek
1 Replies
5. UNIX for Advanced & Expert Users
Hey folks,
When a user is added to a new group, the user has to be log out and log in again to make the new group effective. Is there any system command or technique to refresh user group ID update without re-login?
I am not talking about to use "login" or "su -l" commands which can only make... (2 Replies)
Discussion started by: hce
2 Replies
6. Red Hat
Hello all,
By mistake i edited sshd_config file and made passwordauthentication no , Now i don't have key to login.
Is there any way, i can revert the changes, I am not able to login to the box at well.
Need help.
Thanks,
saurau (3 Replies)
Discussion started by: saurau
3 Replies
7. UNIX for Advanced & Expert Users
Hello,
we have an problem on kubuntu16.04 that when i login with ldap, and it is my first login, nothing is copied from skel. With SSH it is working fine. Can anyone say we how KDE setup an new first userlogin? Tested with SDDM and Lightdm. Thanks a lot!
Best Regard
darktux
----------... (1 Reply)
Discussion started by: darktux
1 Replies
8. Shell Programming and Scripting
I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (1 Reply)
Discussion started by: Gurdza32
1 Replies
CRON(8) System Manager's Manual CRON(8)
NAME
cron - daemon to execute scheduled commands (Vixie Cron)
SYNOPSIS
cron
DESCRIPTION
Cron should be started from /etc/rc or /etc/rc.local. It will return immediately, so you don't need to start it with '&'.
Cron searches /var/spool/cron for crontab files which are named after accounts in /etc/passwd; crontabs found are loaded into memory. Cron
also searches for /etc/crontab and the files in the /etc/cron.d/ directory, which are in a different format (see crontab(5)). Cron then
wakes up every minute, examining all stored crontabs, checking each command to see if it should be run in the current minute. When execut-
ing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if
such exists).
Additionally, cron checks each minute to see if its spool directory's modtime (or the modtime on /etc/crontab) has changed, and if it has,
cron will then examine the modtime on all crontabs and reload those which have changed. Thus cron need not be restarted whenever a crontab
file is modified. Note that the Crontab(1) command updates the modtime of the spool directory whenever it changes a crontab.
SEE ALSO
crontab(1), crontab(5)
AUTHOR
Paul Vixie <paul@vix.com>
4th Berkeley Distribution 20 December 1993 CRON(8)