cancel
Showing results for 
Search instead for 
Did you mean: 

script for passwd -s

 
Highlighted
rajadeepan123
Occasional Visitor

script for passwd -s

Hi ALL

 

I need to execute passwd -s for all users in server.there are 100 users registerd in server.

 

Can any one help in making a script

 

 

 

thanks and regards

 

raja

2 REPLIES 2
Highlighted
rariasn
Honored Contributor

Re: script for passwd -s

Hi Raja:

 

for USER in $(sort -t: -k 1 /etc/passwd|awk -F: '{print $1}')
do
passwd -s $USER
done > /tmp/users.lst

 

man passwd

 

rgs,

 

Highlighted
Dennis Handly
Acclaimed Contributor

Re: script for passwd -s

>sort -t: -k 1 /etc/passwd | awk -F: '{print $1}'

 

It would be easier to sort it after awk, if sorting is even needed.