Operating System - HP-UX
1831664 Members
2319 Online
110029 Solutions
New Discussion

script wanted about change user profile

 
SOLVED
Go to solution
peterchu
Super Advisor

script wanted about change user profile

I have about 200 users ( eg. user1 , user2 .... ) in my system , I need to update the user profile by the below script regularly , now I need to run the below script to make it work but it is waste of time , could suggest a script so that I can make my work easily , besides , if I don't want a list of user ( eg. user10 , user35 ) will not be updated ( that mean will not change the user profile ), could suggest the script ? very thinks in advance

#passwd -x -f -n user1
#passwd -x -f -n user2
#passwd -x -f -n user3
#passwd -x -f -n user4
#passwd -x -f -n user5
2 REPLIES 2
Patrick Wallek
Honored Contributor
Solution

Re: script wanted about change user profile

Manually create your list of users:

# awk -F : '{print $1}' /etc/passwd > user_list

# cp user_list my_user_list

# vi my_user_list

Now make any changes -- delete users you don't want to change or whatever.

Now create the script you'll use and call it whatever you want. I called it passwd_script:

# cat passwd_script

#!/usr/bin/sh

for USER in $(cat my_user_list)
do
echo "Doing user ${USER}"
passwd -x -f -n ${USER}
done


Now do a:

# chmod 700 passwd_script

And then run it. It will go through all users in my_user_list and do the 'passwd -x -f -n' on them.



peterchu
Super Advisor

Re: script wanted about change user profile

it is ok , thx a lot