<?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: Login script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320482#M734689</link>
    <description>Added the SPWCHG value for each user to the last column.  See attachment.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 09 Dec 2008 22:12:02 GMT</pubDate>
    <dc:creator>Autocross.US</dc:creator>
    <dc:date>2008-12-09T22:12:02Z</dc:date>
    <item>
      <title>Login script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320477#M734684</link>
      <description>How would I set this to show active users. I am not a script guru&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;# Show deactivated users in a trusted system&lt;BR /&gt;set -u&lt;BR /&gt;PATH=/usr/bin:/usr/sbin:/usr/lbin&lt;BR /&gt;&lt;BR /&gt;NOTTRUSTED=/sbin/true&lt;BR /&gt;if [ -x /usr/lbin/modprpw ]&lt;BR /&gt;then&lt;BR /&gt;modprpw 1&amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;if [ $? -eq 2 ]&lt;BR /&gt;then&lt;BR /&gt;NOTTRUSTED=/sbin/false&lt;BR /&gt;fi&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;if $NOTTRUSTED&lt;BR /&gt;then&lt;BR /&gt;print "\n This system is not a Trusted System"&lt;BR /&gt;exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;REASON[1]="past password lifetime"&lt;BR /&gt;REASON[2]="past last login time"&lt;BR /&gt;REASON[3]="past absolute account lifetime"&lt;BR /&gt;REASON[4]="exceeding unsuccessful login attempts"&lt;BR /&gt;REASON[5]="password required and a null password"&lt;BR /&gt;REASON[6]="admin lock"&lt;BR /&gt;REASON[7]="password is a *"&lt;BR /&gt;&lt;BR /&gt;for USER in $(listusers | awk '{print $1}')&lt;BR /&gt;do&lt;BR /&gt;LOCKOUT=$(getprpw -r -m lockout $USER)&lt;BR /&gt;ERR=$?&lt;BR /&gt;if [ $ERR != 0 ]&lt;BR /&gt;then&lt;BR /&gt;print "getprpw failed, error = $ERR"&lt;BR /&gt;exit $ERR&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;# Since multiple reasons may exist in LOCKOUT, process&lt;BR /&gt;# each bit position separately&lt;BR /&gt;&lt;BR /&gt;if [ $LOCKOUT != "0000000" ]&lt;BR /&gt;then&lt;BR /&gt;print "\nUser $USER deactivated for:"&lt;BR /&gt;for BIT in 1 2 3 4 5 6 7&lt;BR /&gt;do&lt;BR /&gt;REASONBIT=$(echo $LOCKOUT | cut -c $BIT)&lt;BR /&gt;if [ $REASONBIT != 0 ]&lt;BR /&gt;then&lt;BR /&gt;if [ $REASONBIT = 1 ]&lt;BR /&gt;then&lt;BR /&gt;print " ${REASON[$BIT]}"&lt;BR /&gt;else&lt;BR /&gt;print " Bad character in lockout: $REASONBIT"&lt;BR /&gt;fi&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;fi&lt;BR /&gt;done</description>
      <pubDate>Tue, 09 Dec 2008 19:02:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320477#M734684</guid>
      <dc:creator>Charles Keyser</dc:creator>
      <dc:date>2008-12-09T19:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: Login script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320478#M734685</link>
      <description>This will print both active and inactive users:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;# Show deactivated users in a trusted system&lt;BR /&gt;set -u&lt;BR /&gt;PATH=/usr/bin:/usr/sbin:/usr/lbin&lt;BR /&gt;&lt;BR /&gt;NOTTRUSTED=/sbin/true&lt;BR /&gt;if [ -x /usr/lbin/modprpw ]&lt;BR /&gt;then&lt;BR /&gt;modprpw 1&amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;if [ $? -eq 2 ]&lt;BR /&gt;then&lt;BR /&gt;NOTTRUSTED=/sbin/false&lt;BR /&gt;fi&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;if $NOTTRUSTED&lt;BR /&gt;then&lt;BR /&gt;print "\n This system is not a Trusted System"&lt;BR /&gt;exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;REASON[1]="past password lifetime"&lt;BR /&gt;REASON[2]="past last login time"&lt;BR /&gt;REASON[3]="past absolute account lifetime"&lt;BR /&gt;REASON[4]="exceeding unsuccessful login attempts"&lt;BR /&gt;REASON[5]="password required and a null password"&lt;BR /&gt;REASON[6]="admin lock"&lt;BR /&gt;REASON[7]="password is a *"&lt;BR /&gt;&lt;BR /&gt;for USER in $(listusers | awk '{print $1}')&lt;BR /&gt;do&lt;BR /&gt;LOCKOUT=$(getprpw -r -m lockout $USER)&lt;BR /&gt;ERR=$?&lt;BR /&gt;if [ $ERR != 0 ]&lt;BR /&gt;then&lt;BR /&gt;print "getprpw failed, error = $ERR"&lt;BR /&gt;exit $ERR&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;# Since multiple reasons may exist in LOCKOUT, process&lt;BR /&gt;# each bit position separately&lt;BR /&gt;&lt;BR /&gt;if [ $LOCKOUT != "0000000" ]&lt;BR /&gt;  then&lt;BR /&gt;    print "\nUser $USER deactivated for:"&lt;BR /&gt;    for BIT in 1 2 3 4 5 6 7&lt;BR /&gt;    do&lt;BR /&gt;      REASONBIT=$(echo $LOCKOUT | cut -c $BIT)&lt;BR /&gt;        if [ $REASONBIT != 0 ]&lt;BR /&gt;          then&lt;BR /&gt;            if [ $REASONBIT = 1 ]&lt;BR /&gt;                then&lt;BR /&gt;                        print " ${REASON[$BIT]}"&lt;BR /&gt;                  else&lt;BR /&gt;                        print " Bad character in lockout: $REASONBIT"&lt;BR /&gt;            fi&lt;BR /&gt;        fi&lt;BR /&gt;    done&lt;BR /&gt;  else&lt;BR /&gt;     print "\n\n$USER is active"&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Dec 2008 19:53:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320478#M734685</guid>
      <dc:creator>Autocross.US</dc:creator>
      <dc:date>2008-12-09T19:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Login script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320479#M734686</link>
      <description>Thanks so much. I am going to attempt to add a line to see when the last time logged in and last time password were change here is another script we use. It shows deactivated, we would like to show activated also, the last time user changed password, if they have a null password. We have auditors who found a couple of users whose accounts for password aging set to disabled which violated our policy. I am new here and would like to see the script give all this information. Here it is (Help) to modify&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;# Show deactivated users in a trusted system&lt;BR /&gt;&lt;BR /&gt;set -u&lt;BR /&gt;PATH=/usr/bin:/usr/sbin:/usr/lbin&lt;BR /&gt;typeset -R26 MINTM&lt;BR /&gt;typeset -R26 EXPTM&lt;BR /&gt;typeset -R26 LFTM&lt;BR /&gt;typeset -R26 SPWCHG&lt;BR /&gt;typeset -R26 UPWCHG&lt;BR /&gt;typeset -R26 ACCTEXP&lt;BR /&gt;typeset -R26 LLOG&lt;BR /&gt;typeset -R26 ULOGINT&lt;BR /&gt;typeset -R26 SLOGINY&lt;BR /&gt;typeset -R26 UMAXLNTR&lt;BR /&gt;typeset -R26 NOTSET="-1"&lt;BR /&gt;&lt;BR /&gt;REASON[1]="exceeded password lifetime"&lt;BR /&gt;REASON[2]="exceeded last login time"&lt;BR /&gt;REASON[3]="exceeded absolute account lifetime"&lt;BR /&gt;REASON[4]="exceeded unsuccessful login attempts"&lt;BR /&gt;REASON[5]="password required and a null password"&lt;BR /&gt;REASON[6]="administrator lock"&lt;BR /&gt;REASON[7]="password is a *"&lt;BR /&gt;&lt;BR /&gt;NOTTRUSTED=/sbin/true&lt;BR /&gt;if [ -x /usr/lbin/modprpw ]&lt;BR /&gt;then&lt;BR /&gt;modprpw 1&amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;if [ $? -eq 2 ]&lt;BR /&gt;then&lt;BR /&gt;NOTTRUSTED=/sbin/false&lt;BR /&gt;fi&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;if $NOTTRUSTED&lt;BR /&gt;then&lt;BR /&gt;print "\n This system is not a Trusted System"&lt;BR /&gt;exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;for USER in $(listusers | awk '{print $1}')&lt;BR /&gt;do&lt;BR /&gt;LOCKOUT=$(getprpw -r -m lockout $USER)&lt;BR /&gt;ERR=$?&lt;BR /&gt;if [ $ERR != 0 ]&lt;BR /&gt;then&lt;BR /&gt;print "getprpw failed, error = $ERR"&lt;BR /&gt;exit $ERR&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;# Since multiple reasons may exist in LOCKOUT, process&lt;BR /&gt;# each bit position separately&lt;BR /&gt;&lt;BR /&gt;if [ $LOCKOUT != "0000000" ]&lt;BR /&gt;then&lt;BR /&gt;print "\nUser $USER deactivated, reason: \c"&lt;BR /&gt;for BIT in 1 2 3 4 5 6 7&lt;BR /&gt;do&lt;BR /&gt;REASONBIT=$(echo $LOCKOUT | cut -c $BIT)&lt;BR /&gt;if [ $REASONBIT != 0 ]&lt;BR /&gt;then&lt;BR /&gt;if [ $REASONBIT = 1 ]&lt;BR /&gt;then&lt;BR /&gt;print "${REASON[$BIT]}"&lt;BR /&gt;else&lt;BR /&gt;print "AUDIT error: Bad character in lockout: $REASONBIT"&lt;BR /&gt;fi&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;MINTM=$(getprpw -r -m mintm $USER)&lt;BR /&gt;EXPTM=$(getprpw -r -m exptm $USER)&lt;BR /&gt;LFTM=$(getprpw -r -m lftm $USER)&lt;BR /&gt;SPWCHG=$(getprpw -r -m spwchg $USER)&lt;BR /&gt;UPWCHG=$(getprpw -r -m upwchg $USER)&lt;BR /&gt;ACCTEXP=$(getprpw -r -m acctexp $USER)&lt;BR /&gt;LLOG=$(getprpw -r -m llog $USER)&lt;BR /&gt;ULOGINT=$(getprpw -r -m ulogint $USER)&lt;BR /&gt;SLOGINY=$(getprpw -r -m sloginy $USER)&lt;BR /&gt;UMAXLNTR=$(getprpw -r -m umaxlntr $USER)&lt;BR /&gt;&lt;BR /&gt;# Show values only if set (-1 is not set)&lt;BR /&gt;&lt;BR /&gt;[[ "$MINTM" != "$NOTSET" ]] &amp;amp;&amp;amp; \&lt;BR /&gt;print "$MINTM = Min time between PW changes"&lt;BR /&gt;[[ "$EXPTM" != "$NOTSET" ]] &amp;amp;&amp;amp; \&lt;BR /&gt;print "$EXPTM = Password expiration time"&lt;BR /&gt;[[ "$LFTM" != "$NOTSET" ]] &amp;amp;&amp;amp; \&lt;BR /&gt;print "$LFTM = Password lifetime"&lt;BR /&gt;[[ "$SPWCHG" != "$NOTSET" ]] &amp;amp;&amp;amp; \&lt;BR /&gt;print "$SPWCHG = Password was changed"&lt;BR /&gt;[[ "$UPWCHG" != "$NOTSET" ]] &amp;amp;&amp;amp; \&lt;BR /&gt;print "$UPWCHG = Password was unsuccessfully changed"&lt;BR /&gt;[[ "$ACCTEXP" != "$NOTSET" ]] &amp;amp;&amp;amp; \&lt;BR /&gt;print "$ACCTEXP = account expires"&lt;BR /&gt;[[ "$LLOG" != "$NOTSET" ]] &amp;amp;&amp;amp; \&lt;BR /&gt;print "$LLOG = Last successful login"&lt;BR /&gt;[[ "$SLOGINY" != "$NOTSET" ]] &amp;amp;&amp;amp; \&lt;BR /&gt;print "$SLOGINY = Terminal used for last successful login"&lt;BR /&gt;[[ "$ULOGINT" != "$NOTSET" ]] &amp;amp;&amp;amp; \&lt;BR /&gt;print "$ULOGINT = Last unsuccessful login"&lt;BR /&gt;[[ "$UMAXLNTR" != "$NOTSET" ]] &amp;amp;&amp;amp; \&lt;BR /&gt;print "$UMAXLNTR = Max unsuccessful login tries"&lt;BR /&gt;&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;print&lt;BR /&gt;exit 0</description>
      <pubDate>Tue, 09 Dec 2008 20:34:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320479#M734686</guid>
      <dc:creator>Charles Keyser</dc:creator>
      <dc:date>2008-12-09T20:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Login script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320480#M734687</link>
      <description>I've attached a script that i use to do a similar task with managing expired accounts.&lt;BR /&gt;&lt;BR /&gt;I've added the reason codes from the above script to it.  See if this works for you.&lt;BR /&gt;&lt;BR /&gt;One thing i've noticed is that it only prints the last reason code.  So if the LOCKOUT is something like 1001001, only the last 1 is actually noted in the output.  I can fix this if it's something you may use, but most users probably are locked for 1 reason, not many.</description>
      <pubDate>Tue, 09 Dec 2008 21:21:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320480#M734687</guid>
      <dc:creator>Autocross.US</dc:creator>
      <dc:date>2008-12-09T21:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Login script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320481#M734688</link>
      <description>I showed my boss and he said thanks, he would like to know if you could add a another column to say last time password was reset?&lt;BR /&gt;&lt;BR /&gt;Thanks for all of your help</description>
      <pubDate>Tue, 09 Dec 2008 21:40:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320481#M734688</guid>
      <dc:creator>Charles Keyser</dc:creator>
      <dc:date>2008-12-09T21:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Login script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320482#M734689</link>
      <description>Added the SPWCHG value for each user to the last column.  See attachment.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Dec 2008 22:12:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320482#M734689</guid>
      <dc:creator>Autocross.US</dc:creator>
      <dc:date>2008-12-09T22:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Login script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320483#M734690</link>
      <description>Thanks for all of your help. That is exactly what I needed. I appreciate your time on this&lt;BR /&gt;&lt;BR /&gt;-Charlie</description>
      <pubDate>Mon, 15 Dec 2008 14:29:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320483#M734690</guid>
      <dc:creator>Charles Keyser</dc:creator>
      <dc:date>2008-12-15T14:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Login script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320484#M734691</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;last output with a grep can be used to get last login information, so long as the wtmp file in /var/adm/syslog is not erased or emptied.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 15 Dec 2008 14:45:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320484#M734691</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2008-12-15T14:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Login script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320485#M734692</link>
      <description>I called Charles attached script "chkdisable" and execute with the following: &lt;BR /&gt;&lt;BR /&gt;chkdisable |grep exceed |awk '{print $2}'&lt;BR /&gt;&lt;BR /&gt;To determine any current lockouts.</description>
      <pubDate>Mon, 15 Dec 2008 15:58:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/login-script/m-p/4320485#M734692</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2008-12-15T15:58:59Z</dc:date>
    </item>
  </channel>
</rss>

