[ start | index | login ]
start > knowledgebase > linux > misc > mass setting user passwords

mass setting user passwords

Created by retep. Last edited by retep, 3 years and 81 days ago. Viewed 1,793 times. #3
[diff] [history] [edit] [rdf]
labels
attachments
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
请以发表评论身份登录
Powered by snipsnap.org Found a mistake in a howto? Let us know via an email to p.blikibugs at rimuhosting com.