In my workplace we had about 55 users and we needed to set a standard password for all these users (of course we would let them modify it for a secret password after the first login). I am lazy, therefore I didn’t want to set a standard password one by one. With the code below it was possible to get each user listed in the file users.txt and set the standard password “pass” for each one of them.


for f in $( cat /root/users.txt ); do echo -ne "pass\npass\n" | smbpasswd -a -s $f; done

Of course, alternatively, I could use “ls /home” instead of “cat /root/users.txt”.

Advertisements