Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

auditing

Posted on 1999-06-26
7
Medium Priority
?
230 Views
Last Modified: 2013-12-23
I need to monitor the active users at present from my system. I have around 300 users in the password file. And I am sure around 100 of them may be old users (means they are either not using my system or they already left the company). I need to track
a- how many current users are there on my system this month?
b- how many were there in the last month?
c- how many were there in month before that?

Because we have file system problem time to time we compress our wtmp & btmp files.

Please give a better solution to solve this problem.
Thank you very much in advance for the unix wizards.
0
Comment
Question by:riname
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 

Author Comment

by:riname
ID: 1583860
Please try to give an answer asap.
0
 
LVL 1

Accepted Solution

by:
alextr earned 400 total points
ID: 1583861
Since you must use "last" command to have simle solution on it you should decompress your wtmpx file and for example you could perform this command
last | grep <Month> | awk '{print $1}' | sort | uniq
to obtain month you could extract it from "date" command. I hope it helps.
0
 
LVL 2

Expert Comment

by:GP1628
ID: 1583862
try this...... (I did it in tcsh so that the * would break out)

cd /home
finger -s *

If that gives you a report of all your users and the last time they were in then you've got a good start. Grep for the month you want and pipe it thru WC with an L switch for line count which will give you a quick count.
cd /home
finger -s * | grep "Jun " |wc -l  


0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 2

Expert Comment

by:GP1628
ID: 1583863
forgot to mentiont aht the asterisk is using the home dir names for a list of who to finger. If "finger -s name" is an option but the asterisk trick doesnt work then let me know and I will do a longer version for you to get a list of users.


0
 
LVL 2

Expert Comment

by:bedot
ID: 1583864
why don't you use the who command on the wtmp file?

IE: who /etc/wtmp
....
chevi      pty/ttyfa    Jun 30 16:02
chevi      pty/ttyfb    Jun 30 16:03
chevi      pty/ttyf3    Jun 30 16:14
chevi      pty/ttyf3    Jun 30 16:15
chevi      pty/ttyf1    Jun 30 16:51
chevi      pty/ttyf1    Jun 30 17:07
chevi      pty/ttyf1    Jun 30 17:46
chevi      pty/ttyf1    Jun 30 18:09
icbiret    pty/ttyf1    Jul  1 08:01
root       ttyp1        Jul  1 08:23
chevi      pty/ttyf1    Jul  1 08:36
chevi      pty/ttyf1    Jul  1 08:50
icbcet1    pty/ttyf2    Jul  1 08:51
chevi      pty/ttyf1    Jul  1 09:33
chevi      pty/ttyf2    Jul  1 09:35
root       ttyp2        Jul  1 09:39
chevi      pty/ttyf1    Jul  1 10:31
chevi      pty/ttyf2    Jul  1 10:31
chevi      pty/ttyf1    Jul  1 11:10
root       ttyp2        Jul  1 11:43
.....

that gives the login, the tty and the date


;-)


0
 

Author Comment

by:riname
ID: 1583865
It works fine. Excellent.

 last | grep Jul | awk '{print $1}' | sort | uniq | wc -l


finger -s * | grep "Jun" | wc -l

The finger command (from another well wisher) gives slightly different answer. can you pls elaborate.

Thank you very much.


0
 
LVL 1

Expert Comment

by:alextr
ID: 1583866
I think with finger you cannot have good results.
Then using * you have no good information. I tried but it didn't return info related on logged users.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re involved with your company’s wide area network (WAN), you’ve probably heard about SD-WANs. They’re the “boy wonder” of networking, ostensibly allowing companies to replace expensive MPLS lines with low-cost Internet access. But, are they …
This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question