Results 1 to 5 of 5
Hi all,
I'm writing a program that allows the user to enter a certain username contained in the home directory which brings bring up their details.
i.e.
1. Are they ...
- 12-05-2007 #1
Bash
Hi all,
I'm writing a program that allows the user to enter a certain username contained in the home directory which brings bring up their details.
i.e.
1. Are they logged on now
2. When did they last log on
3. What groups are they in
How would I go about doing this.
I understand that I will have to use the last command to find data on a users last log in but the system only seems to store log on details for the last few days, when a user might have last logged on months ago.
Any suggestions?
Thanks
- 12-06-2007 #2Just Joined!
- Join Date
- Dec 2007
- Posts
- 11
hiiiiiiiiii
hi i m very new for this linux forum..........
really it is very nice.
and till now i came across i missed a lots of things before joing this good forum.
- 12-06-2007 #3
for 1 and 2 you can use "last" as you have mentioned. It shows the last time a user logged on as if they are still currently logged in. For 3 you can use groups. e.g.
If last does not go back far enough then you could use some other way of archiving /var/log/wtmp to a file every day (cat /var/log/wtmp >> /var/log/wtmp.big, for example?) and then using grep to search through it. The /var/log/wtmp.big file would get big over time so you could use awk to truncate x number of lines or days of data from the start of the file.Code:last ben ben pts/1 192.168.0.10 Thu Dec 6 22:06 - 22:06 (00:00) groups ben ben : ben
Registered Linux user #389109
My Semi-Linux Blog
- 12-06-2007 #4
You use finger for this. Finger can do everything you request except group membership, which is easiest done with id.
- 12-07-2007 #5
Thanks for you all replies.
With a little trial and error and using your advice I've been able to advance quite a lot.
I have to connect to a linux server at uni and therefore do not have root access which makes life just a tad harded.
Any how
Thanks again


Reply With Quote
