Operating System - HP-UX
1833053 Members
2573 Online
110049 Solutions
New Discussion

Mass deactivation of user accounts

 
SOLVED
Go to solution
Renante M. Yu_1
Occasional Advisor

Mass deactivation of user accounts

Hi to all,

How do I lock a certain number of users in trusted systems?

Thanks
Only dead people have seen peace
5 REPLIES 5
Sundar_7
Honored Contributor
Solution

Re: Mass deactivation of user accounts

Hi,

1) Enter the usernames in a file - one user in a line

# cat /tmp/userlist
user1
user2
user3
..
usern
#

2) for USER in $(cat /tmp/userlist)
do
passwd -l $USER
done

Sundar
Learn What to do ,How to do and more importantly When to do ?
Steven E. Protter
Exalted Contributor

Re: Mass deactivation of user accounts

passwd -l


make a list of users in a file


while read -r aa
do

passwd -l $aa
done < file

#Done

Sorry it took so long.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jim Mallett
Honored Contributor

Re: Mass deactivation of user accounts

passwd is definitely the suggested command as mentioned above. Just so you have another command in your arsenal, in a trusted system you can also use modprpw.

Create a file containing the list of users (ie: /tmp/users.txt)

for UNAME in $(cat /tmp/users.txt)
/usr/lbin/modprpw -m alock=YES $UNAME
done

When (if) you want to unlock the accounts you can change the command to:
/usr/lbin/modprpw -k $UNAME

Jim


Hindsight is 20/20
Jim Mallett
Honored Contributor

Re: Mass deactivation of user accounts

Sorry, forgot the "do" in the for loop. Been away too long.
Hindsight is 20/20
Renante M. Yu_1
Occasional Advisor

Re: Mass deactivation of user accounts

Thanks to all
Only dead people have seen peace