Score:1

Change the password for group of users by single command

in flag

I'm looking for changing the password for a group of users with a single command. I tried the following command, which I believe that should work for me unless I missed something:

for i in {user1, user2,..}; do echo {new password}; passwd --stdin \; done

but unfortunately I'm getting the following error:

-su: syntax error near unexpected token `echo'

Could someone correct me and let me now where is the mistake in my command?

ingank avatar
cn flag
If you want to set "OnePassword" as password to multiple users: (as root) `for i in foo bar; do echo "$i:OnePassword" | chpasswd; done` or if you want to set multiple passwords to multiple users: (as root) `for i in foo bar; do read -p "Set password for $i: " pwd; echo "$i:$pwd" | sudo chpasswd; done`
Rashid Linux avatar
in flag
Yes, it works for me, although that was a different format - but it's working just fine thank you BestOfCaerbannog
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.