LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-18-2003, 03:17 AM   #1
sneak_nakata
LQ Newbie
 
Registered: Aug 2003
Posts: 3

Rep: Reputation: 0
Exclamation How we can put last login like root in Redhat?


Ok.. my problem is like this..

I want to know how to set the last login like root at the user account. An example when we successfully login, we got like this...

root@192.168.0.2's password:
Last login: Mon Aug 18 14:54:43 2003 from 192.168.0.1

I hope u'all care to show how to do it.. thanks!
 
Old 08-18-2003, 10:19 AM   #2
jdruin
Member
 
Registered: Jul 2003
Location: Louisville aka Derby City
Distribution: WinXP SP2 and SP3, W2K Server, Ubuntu
Posts: 313

Rep: Reputation: 30
Not sure what you are trying to do. Perhaps reword the question? What are you trying to accomplish? Here is some info on where that last login statement comes from.

In var/log/lastlog (a data file), there is an entry for each user on the system that contains the data about when the last login occured (if ever).

In /var/log/wtmp shows a complete list, in order, of all the users trying to log in and out plus reboots. THis is also a data file.

You can use 'lastlog' to view the contents of the var/log/lastlog and 'last' to view the contents of /var/log/wtmp
 
Old 08-18-2003, 03:05 PM   #3
sneak_nakata
LQ Newbie
 
Registered: Aug 2003
Posts: 3

Original Poster
Rep: Reputation: 0
I mean like this, Firstly we login to redhat using putty program

username : root
password : blabalabla..

after that, the root account will display

root@192.168.0.2's password:
Last login: Mon Aug 18 14:54:43 2003 from 192.168.0.1

I want it display above information to my user account once i log in with user account, my user account is "babyboy"
so i want my user account can display the last login automaticly after i login with babyboy..

is it my question clear? hope it will clear u.. thanks..
 
Old 08-18-2003, 03:26 PM   #4
jdruin
Member
 
Registered: Jul 2003
Location: Louisville aka Derby City
Distribution: WinXP SP2 and SP3, W2K Server, Ubuntu
Posts: 313

Rep: Reputation: 30
Okay. I think I see what you need. I think you can put this in your .bashrc for babyboy if you just want to see who logged in before you did:

last -d -f /var/log/wtmp -n 2

This will display 2 lines, the first will be about (babyboy) since he is the last login and the second line will be whoever logged in just before babyboy.

You could also do this:

lastlog -u root

to see when the last time root logged in.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to enable auto login for root in Redhat alix123 Programming 5 06-27-2007 01:43 AM
Redhat 9 root login password jmzcons Linux - Software 1 02-27-2005 05:30 PM
redhat 9 login as root but what next? keg Linux - Newbie 5 02-03-2004 12:28 AM
Redhat Linux login problem with non-root user wxxg Linux - Software 0 09-02-2003 12:27 AM
Redhat 7.1 problems in root login through kde prpsarathy435 Linux - General 0 06-08-2002 09:58 PM


All times are GMT -5. The time now is 04:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration