cancel
Showing results for 
Search instead for 
Did you mean: 

script for max times logon

SOLVED
Go to solution
Charles Keyser
Frequent Advisor

script for max times logon

We have 7 HP-UX servers, if someone could help with a very simple script using this command
./getprdef -t cjk1402
umaxlntr=5, tmaxlntr=5, dlylntr=2, lntmout=30

That will check users on the servers. I used my logon as a single user check, I would like it to check everyone. My main concern is umaxlntr=5
The old administrator mad changes on several users which is in violation of our audit policy, a script would allow me to see all that has been changed instead of using sam and looking at them one at a time. Any help is greatly appreciated
-Charlie
6 REPLIES
Tim Nelson
Honored Contributor
Solution

Re: script for max times logon

awk -F: '{print $1} /etc/passwd|while read username
do
getprpw -m umaxlntr $username
done

(a value of -1 means default)

or

awk -F: '$3>100 {print $1} ... ( to find users with IDs over 100 )
Charles Keyser
Frequent Advisor

Re: script for max times logon

Thanks Tim

I have tried to run the script received the below error

Syntax error at line 10 : `(' is not expected.

Thanks for your help
Hakki Aydin Ucar
Honored Contributor

Re: script for max times logon

Correction:

to use getprpw first you need trusted system and some cases full_path ;

awk -F: '{print $1}' /etc/passwd|while read username
do
/usr/lbin/getprpw -m umaxlntr $username
done


Tim Nelson
Honored Contributor

Re: script for max times logon

Sorry.. forgot an apostrophy
Charles Keyser
Frequent Advisor

Re: script for max times logon

Thanks again. Here is the out put

umaxlntr=-1
umaxlntr=-1
umaxlntr=25
umaxlntr=-1
umaxlntr=-1
umaxlntr=-1
umaxlntr=-1

I need to be able to identify the user/users that have more then one where there is one who has 25 I would like to see the users logon id

Thanks again
Tim Nelson
Honored Contributor

Re: script for max times logon

awk -F: '{print $1}' /etc/passwd|while read username
do
echo $username
/usr/lbin/getprpw -m umaxlntr $username
done

or

awk -F: '{print $1}' /etc/passwd|while read username
do
retry=`/usr/lbin/getprpw -m umaxlntr $username|awk -F= '{print $2}'`

if [[ $retry -gt 25 ]]
then
echo "$username is over 25 limit"
fi
done