LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-16-2013, 11:22 AM   #1
rgsurfs
LQ Newbie
 
Registered: May 2013
Posts: 18

Rep: Reputation: Disabled
How can I display a user's last login info, immediately after they login via gui?


RedHat 5.

After I log into the server as root, from gdm/gui, how can I get my last login data to display or pop-up automatically?

I've tried adding last -1 as the last line in each of these files but all i get is a blank window that displays without any data and quickly closes:

/etc/bashrc
/etc/profile
/root/.bashrc files.

tks

Robert
 
Old 05-16-2013, 05:19 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by rgsurfs View Post
After I log into the server as root,
It is not a security best practice. You should not (need to) do that.


Quote:
Originally Posted by rgsurfs View Post
how can I get my last login data to display or pop-up automatically?
Desktop Environments (DE) provide you with features to run applications on startup. Find our how your DE does that. Then make it run an executable shell script that does something like
Code:
zenity --warning --text="$(last -n 3 $LOGNAME|tr -s ' ')"
or
Code:
xterm -e "last -n 3 $LOGNAME; sleep 10s"
or something like that.
 
1 members found this post helpful.
Old 05-17-2013, 08:51 AM   #3
rgsurfs
LQ Newbie
 
Registered: May 2013
Posts: 18

Original Poster
Rep: Reputation: Disabled
rgrg the security concerns about logging in as root.

the zenity command did the trick. I added it to the .bash_profile for my regular user.

zenity --warning --text="Last Login: $(last -1)"

tks !!!!!!

getting closer. the last -1 gives methe login that I just did.. Need the one previuos... hahaha learning is fun !!!!

Robert

Last edited by rgsurfs; 05-17-2013 at 09:07 AM.
 
Old 05-17-2013, 08:54 AM   #4
rgsurfs
LQ Newbie
 
Registered: May 2013
Posts: 18

Original Poster
Rep: Reputation: Disabled
better yet. I added it as the last line of /etc/profile :-)

same as above. almost there...

Last edited by rgsurfs; 05-17-2013 at 09:07 AM.
 
  


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
Ubuntu/AD/KRB5/LDAP/NIS able to use domain user login with putty, unable in gui login Nitroglycerine Linux - Server 0 06-28-2012 04:17 AM
need to get last login info of each user tahaz Linux - Newbie 19 05-30-2012 06:06 PM
unable to login any user through the console but users can login in GUI p kumar Linux - Server 1 04-19-2012 06:09 AM
non privileged user sessions close immediately after login. lcstew Linux - Security 2 04-16-2009 04:42 PM
Prompt user for information immediately after login? bpottle Linux - Software 1 05-31-2006 09:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:02 AM.

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
Open Source Consulting | Domain Registration