1829914 Members
1660 Online
109993 Solutions
New Discussion

Login profile

 
Angela Swyers_1
Frequent Advisor

Login profile

How do I get the system to display the last successful login and the last unsuccessful login when a user is logging in to a system?
7 REPLIES 7
curt larson_1
Honored Contributor

Re: Login profile

use lastb to get the last bad logins
/usr/bin/lastb -3 ${LOGNAME}

use last for sucessful logins
Michael Denney
Valued Contributor

Re: Login profile

"last" and "lastb"
Bharat Katkar
Honored Contributor

Re: Login profile

Hi Again,

# lastb -R

This works fine.

All the best.
You need to know a lot to actually know how little you know
Uday_S_Ankolekar
Honored Contributor

Re: Login profile

'last' command for good login and 'lastb' for bad logins!

-USA..
Good Luck..
Marvin Strong
Honored Contributor

Re: Login profile

If you wanted it for all users, then you would use the last and lastb commands is /etc/profile


last -1 ${LOGNAME}
lastb -1 ${LOGNAME}
Sanjay_6
Honored Contributor

Re: Login profile

Hi,

If your system is trusted, this info is automatically displayed whenever the user logs in.

Hope this helps.

Regds
Jeff_Traigle
Honored Contributor

Re: Login profile

Actually, last -1 ${LOGNAME} doesn't really tell you the last successful login... it tells you the current successful login in this case (since the user is the one specified by ${LOGNAME}). I think you'd actually want to do something like this:

last -2 ${LOGNAME} | tail -1
--
Jeff Traigle