- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- last login time of a particular user
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2005 03:20 PM
11-20-2005 03:20 PM
I need to find last login date/time of a user.
How to find this ?
Thanks,
Shiv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2005 03:32 PM
11-20-2005 03:32 PM
Re: last login time of a particular user
you need last -R|pg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2005 04:29 PM
11-20-2005 04:29 PM
Solutionuse last or lastb command.
The last command searches backwards through the file /var/adm/wtmp which contains a record of all logins and logouts information about a user, a tty, or any group of users and ttys.
Lastb will give you in the lastest date order.
The output will show login username terminal and the date (in format Mon Nov 21 HH:MM)
IA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2005 05:26 PM
11-20-2005 05:26 PM
Re: last login time of a particular user
You can use:
# last -R
# lastb -R
# who -R
lastb tells about bad logins whereas last will tell about good logins.
"Who -R" will list all the users logged in alongewith their IP addresses.
Hope that helps.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2005 09:39 PM
11-20-2005 09:39 PM
Re: last login time of a particular user
#last -R user_name
will show you all the logings for are user_name with the network address for that user_name there you can see the time and duration.
#lastb -R user_name
will show you all bad login attempts of user_name
Regards,
Borislav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2005 09:55 PM
11-20-2005 09:55 PM
Re: last login time of a particular user
#last -R username
would be what you want.
Good Luck,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2005 10:00 PM
11-20-2005 10:00 PM
Re: last login time of a particular user
usage: last [ -number ] [ -f file] [ -R ] [ name ... ] [ tty ... ]
e.g.
# last -R yd
yd ftp myserver.db.mu Thu Aug 11 13:36 - 13:36 (00:00)
yd ftp myserver.db.mu Thu Aug 11 13:29 - 13:29 (00:00)
yd ftp myserver.db.mu Thu Aug 11 13:21 - 13:29 (00:08)
yd ftp myserver.db.mu Thu Aug 11 13:21 - 13:29 (00:08)
yd ftp myserver.db.mu Thu Aug 11 13:20 - 13:29 (00:09)
yd ftp myserver.db.mu Thu Aug 11 13:19 - 13:29 (00:10)
the second column would indicate the type of connection initiated: ftp or telnet (in most cases here)
hope this helps too!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2005 10:01 PM
11-20-2005 10:01 PM
Re: last login time of a particular user
How does it work,
it is build from /etc/utmp.
a raw view can be done with strings /etc/utmp
and /etc/wtmp for hostnames
hopefully this in-depth info is usefull
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2005 12:29 AM
11-21-2005 12:29 AM
Re: last login time of a particular user
If the file '/var/adm/wtmp' doesn't exist, no logging will occur. Similarly, you can enable (or not) "bad" login accounting by creating (touching) '/var/adm/btmp'.
'/var/adm/wtmp' may be made readable by anyone, BUT do not make '/var/adm/bwtmp' readable by anyone but root since it is possible that user passwords may be present in 'btmp' from bundlged login attempts.
These files grow without bounds and must be periodically trimmed. One way is to simply null them:
# cat /dev/null > /var/adm/wtmp
The files are binary files and cannot be manipulated with normal text-handling tools. If you want to preserve some contents, you must convert the binary file to an ASCII file; edit (delete) what you don't want; and convert the ASCII file back to the binary format:
# /usr/sbin/acct/fwtmp < /var/adm/wtmp > /tmp/wtmp
...edit; and then...
# /usr/sbin/acct/fwtmp -ic < /tmp/wtmp > /var/adm/wtmp
You can do the same for the 'btmp' data.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2005 03:16 AM
11-21-2005 03:16 AM
Re: last login time of a particular user
Here is is :
# last -R | grep "username" | head -n 10
Will show a particular user loggedin for how much time and when. And will show last 10 entry.
You can also find out , from who -R or who -u , the current users logged in.
/var/adm/wtmp keeps the log.
Cheers,
Raj.