<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: user audit scripts in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968408#M95564</link>
    <description>Hey&lt;BR /&gt;&lt;BR /&gt;Have you already searched in this forum?&lt;BR /&gt;&lt;BR /&gt;check this thread: &lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1006456" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1006456&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps a bit.&lt;BR /&gt;&lt;BR /&gt;Regards</description>
    <pubDate>Mon, 26 Mar 2007 09:18:43 GMT</pubDate>
    <dc:creator>Oviwan</dc:creator>
    <dc:date>2007-03-26T09:18:43Z</dc:date>
    <item>
      <title>user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968398#M95554</link>
      <description>Hi,&lt;BR /&gt;I am new to scripting.  Could someone have user audit shell scripts for following purpose.&lt;BR /&gt;&lt;BR /&gt;1. List of All Groups and Members of Groups.&lt;BR /&gt;Report should looklike&lt;BR /&gt;GID --- USERID----Last login date&lt;BR /&gt;2. List of Users with no Activity in past six months.&lt;BR /&gt;&lt;BR /&gt;My OS is hp-ux 11.00. &lt;BR /&gt;&lt;BR /&gt;Thanking you in advance,&lt;BR /&gt;Kannan&lt;BR /&gt;</description>
      <pubDate>Sun, 25 Mar 2007 02:39:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968398#M95554</guid>
      <dc:creator>Kanan</dc:creator>
      <dc:date>2007-03-25T02:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968399#M95555</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;Your request is not specific enough to provide a complete script. I will give over a few concepts.&lt;BR /&gt;&lt;BR /&gt;/etc/group&lt;BR /&gt;&lt;BR /&gt;This lists all groups and can be used with awk to select other information based on group.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;cat /etc/group | awk '{print $1}' &amp;gt; file&lt;BR /&gt;&lt;BR /&gt;while read -r groupname&lt;BR /&gt;do&lt;BR /&gt;   grep $groupname /etc/passwd # awk can be used for refinement&lt;BR /&gt;&lt;BR /&gt;done &amp;lt; file&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=51050" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=51050&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The link above connects to a treasure trove of syadmin scripts. One of them might do exactly what you want.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Sun, 25 Mar 2007 02:52:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968399#M95555</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2007-03-25T02:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968400#M95556</link>
      <description>Hi Kanan,&lt;BR /&gt;&lt;BR /&gt;This is the quickest one you can try at:&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;for i in `awk -F: '{print $1}' /etc/passwd`&lt;BR /&gt;do&lt;BR /&gt;grep $1 /etc/passwd|cut &lt;BR /&gt;last -1 -R $i|grep -v wtmp|grep -v '^ *$'&lt;BR /&gt;done&lt;BR /&gt;---&lt;BR /&gt;and do a man last&lt;BR /&gt;&lt;BR /&gt;If you finetune it with SEP's one you can almost get whatever you want.&lt;BR /&gt;&lt;BR /&gt;There is an system auditing feature availabe on hp-ux also but needs good understanding.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rasheed Tamton.&lt;BR /&gt;</description>
      <pubDate>Sun, 25 Mar 2007 07:15:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968400#M95556</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2007-03-25T07:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968401#M95557</link>
      <description>Sorry, I pasted an incomplete script which I was just testing.&lt;BR /&gt;&lt;BR /&gt;The working one is below:&lt;BR /&gt;&lt;BR /&gt;for i in `awk -F: '{print $1}' /etc/passwd`&lt;BR /&gt;do&lt;BR /&gt;last -1 -R $i|grep -v wtmp|grep -v '^ *$'&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Rasheed Tamton.</description>
      <pubDate>Sun, 25 Mar 2007 07:19:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968401#M95557</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2007-03-25T07:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968402#M95558</link>
      <description>Hi Kannan:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I am new to scripting.&lt;BR /&gt;&lt;BR /&gt;Then the best way to begin is to try to _write_ something.&lt;BR /&gt;&lt;BR /&gt;Look at the manpages for 'last(1)', 'listusers(1)' and 'logins(1M)'.  These would be very useful in providing the data you want to satisfy your request.&lt;BR /&gt;&lt;BR /&gt;You can use 'cut' or 'awk' to snip fields from either the raw group and password files or from the output of the above commands.&lt;BR /&gt;&lt;BR /&gt;If you need an overview or a re-fresher for the shell, this is brief and free:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.docs.hp.com/en/B2355-90046/B2355-90046.pdf" target="_blank"&gt;http://www.docs.hp.com/en/B2355-90046/B2355-90046.pdf&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I would urge you to use the Posix shell as this is the HP-UX standard.  It aligns closely with the Korn shell or even the Linux Bash shell to a large extent.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sun, 25 Mar 2007 12:02:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968402#M95558</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-25T12:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968403#M95559</link>
      <description>Thanks all for immediate response. &lt;BR /&gt;&lt;BR /&gt;How do we check the Users with no activity in last 6 months.?&lt;BR /&gt;&lt;BR /&gt;Also # passwd -s &lt;LOGIN name=""&gt; is not working for NIS users. Is there any known issues for password aging feature with NIS. &lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Anil&lt;BR /&gt;&lt;BR /&gt;&lt;/LOGIN&gt;</description>
      <pubDate>Mon, 26 Mar 2007 05:47:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968403#M95559</guid>
      <dc:creator>Kanan</dc:creator>
      <dc:date>2007-03-26T05:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968404#M95560</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;for i in `awk -F: '{print $1}' /etc/passwd`&lt;BR /&gt;do&lt;BR /&gt;last -1 $i|awk '{print $1, $4, $5}'|grep -v wtmp|grep -v '^ *$'&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;This might give you the last one login from all the users who had logged in the system.&lt;BR /&gt;&lt;BR /&gt;There is an old script from Paula (below link)  may be it will be useful for you.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=39611" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=39611&lt;/A&gt;&lt;BR /&gt; &lt;BR /&gt;Reg. NIS, did you check the /etc/nsswitch.conf&lt;BR /&gt;&lt;BR /&gt;May be you need to use passwd -r nis&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rasheed Tamton.</description>
      <pubDate>Mon, 26 Mar 2007 07:03:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968404#M95560</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2007-03-26T07:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968405#M95561</link>
      <description>Hi Anil,&lt;BR /&gt;&lt;BR /&gt;Below is a DIRTY and tricky script with minor changes to the above one.&lt;BR /&gt;If you are really looking for a SIMPLE one it will help you for the time being.&lt;BR /&gt;&lt;BR /&gt;for i in `awk -F: '{print $1}' /etc/passwd`&lt;BR /&gt;do&lt;BR /&gt;last -1 $i|awk '{print $1, $4, $5}'|grep -E 'Mar|Feb|Jan|Dec|Nov|Oct' |grep -v w&lt;BR /&gt;tmp|grep -v '^ *$'&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;(I just put the last six months from March backwards!!!)&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rasheed Tamton.</description>
      <pubDate>Mon, 26 Mar 2007 07:14:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968405#M95561</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2007-03-26T07:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968406#M95562</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;While '/var/adm/wtmp' and 'last' is the standard vehicle for reading the binary file, the output does not include the _year_ of the entry, only the month.&lt;BR /&gt;&lt;BR /&gt;A more useful mode in which to interpret 'wtmp' data is to transform the binary file into an Ascii text file:&lt;BR /&gt;&lt;BR /&gt;# /usr/sbin/acct/fwtmp &amp;lt; /var/adm/wtmp &amp;gt; /tmp/wtmp &lt;BR /&gt;&lt;BR /&gt;...or push the data into a pipe:&lt;BR /&gt;&lt;BR /&gt;# /usr/sbin/acct/fwtmp &amp;lt; /var/adm/wtmp | ... &lt;BR /&gt;&lt;BR /&gt;One advantage of this is that the full date (+year) is available let alone the epoch seconds timestamp.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF... &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Mar 2007 08:24:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968406#M95562</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-26T08:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968407#M95563</link>
      <description>I dont have a old version of wtmp. Somebody has cleared it for hoouse keeping purpose. Is there any other way to see the last login info. I have around 1000 users and I need to find out users those are inactive for last 6 months.&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Mar 2007 09:00:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968407#M95563</guid>
      <dc:creator>Kanan</dc:creator>
      <dc:date>2007-03-26T09:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968408#M95564</link>
      <description>Hey&lt;BR /&gt;&lt;BR /&gt;Have you already searched in this forum?&lt;BR /&gt;&lt;BR /&gt;check this thread: &lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1006456" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1006456&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps a bit.&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Mon, 26 Mar 2007 09:18:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968408#M95564</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-03-26T09:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968409#M95565</link>
      <description>does anyone has a shell script to get a report of users with no activity in last 6 months in handy. Its a non-trusted 11.0 environment.&lt;BR /&gt;&lt;BR /&gt;Thanking you in advance,&lt;BR /&gt;</description>
      <pubDate>Sun, 01 Apr 2007 08:35:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968409#M95565</guid>
      <dc:creator>Kanan</dc:creator>
      <dc:date>2007-04-01T08:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968410#M95566</link>
      <description>I would follow the advice on the scripts by the others, but play with awk and finger.&lt;BR /&gt;For instance,&lt;BR /&gt;while (done==0)&lt;BR /&gt;finger * | awk '{ print $3,$9,$10,$11,$22,$23,$24 }' &amp;gt;&amp;gt; /finger_info&lt;BR /&gt;I'm not sure it would pull it in correctly, and it depende that you have finger installed.  What you could do with awk is redirect all the output of finger to a file, and then use the awk getline function to read line by line, then test for the date being within 6 months and print it out to a report file.&lt;BR /&gt;Just thoughts, but always far different than reality.</description>
      <pubDate>Tue, 03 Apr 2007 15:41:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968410#M95566</guid>
      <dc:creator>Douglas James Cameron</dc:creator>
      <dc:date>2007-04-03T15:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968411#M95567</link>
      <description>Could some one tell me how do I search for last 6 months from now. I tried some r&amp;amp;d's but didnt got a result.&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Tue, 10 Apr 2007 00:45:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968411#M95567</guid>
      <dc:creator>Kanan</dc:creator>
      <dc:date>2007-04-10T00:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: user audit scripts</title>
      <link>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968412#M95568</link>
      <description>Hi Kannan,&lt;BR /&gt;If you have backups of old wtmp files somewhere for the last six months - you can do like this as a workaround:&lt;BR /&gt;&lt;BR /&gt;-Make a backup of the current wtmp file&lt;BR /&gt;- restore the old wtmp files, &lt;BR /&gt;rename those to different names,  &lt;BR /&gt;and concatenate those files with the current wtmp and do the above scripts using last or finger on that. &lt;BR /&gt;&lt;BR /&gt;If you want some editing on wtmp you can use :&lt;BR /&gt;&lt;BR /&gt;/usr/lib/acct/fwtmp &amp;lt; wtmp &amp;gt; wtmp.txt&lt;BR /&gt;vi wtmp.txt&lt;BR /&gt; Convert back the modified wtmp.txt file back to original wtmp&lt;BR /&gt;(before this step make sure that you have the original backup of wtmp)&lt;BR /&gt;&lt;BR /&gt;/usr/lib/acct/fwtmp -ic &amp;lt; wtmp.txt &amp;gt; wtmp &lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rasheed Tamton.</description>
      <pubDate>Wed, 11 Apr 2007 02:23:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/user-audit-scripts/m-p/3968412#M95568</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2007-04-11T02:23:52Z</dc:date>
    </item>
  </channel>
</rss>

