LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 12:22 PM   #1
rgsurfs
LQ Newbie
 
Registered: May 2013
Posts: 17

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, 06:19 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533
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, 09:51 AM   #3
rgsurfs
LQ Newbie
 
Registered: May 2013
Posts: 17

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 10:07 AM.
 
Old 05-17-2013, 09:54 AM   #4
rgsurfs
LQ Newbie
 
Registered: May 2013
Posts: 17

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 10: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 05:17 AM
need to get last login info of each user tahaz Linux - Newbie 19 05-30-2012 07:06 PM
unable to login any user through the console but users can login in GUI p kumar Linux - Server 1 04-19-2012 07:09 AM
non privileged user sessions close immediately after login. lcstew Linux - Security 2 04-16-2009 05:42 PM
Prompt user for information immediately after login? bpottle Linux - Software 1 05-31-2006 10:59 AM


All times are GMT -5. The time now is 05:36 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration