msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

04 Sep 2007 Mass setting user passwords

Posted by

Every need to change (or set) passwords for a large number of users? Something like this code snippet may help.

# find all the usernames with bash logins
usernames=$(cat /etc/passwd  | grep bash | sed 's/:.*//g)
for i in $usernames; do
    echo "somepassword" | passwd --stdin $i
done

Tags:

Comments are closed.