Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 5452  / 2 Years ago, sat, march 26, 2022, 3:57:59

I need to create a new user account with password in more than 200 systems. What will be the easiest way? Is it possible to do this task via bash script or perl script?


More From » users

 Answers
6

Generate the password with perl perl -e 'print crypt("passwd", "passwd");'.



Then just use a bash script to call useradd via ssh on each server (assuming you already setup ssh keys for password-less login, otherwise this will get old, fast)



pass=$(perl -e 'print crypt("passwd", "passwd");')
for srv in $(cat server.list); do
ssh $srv useradd -m -p "$pass" username
done


and check the manpage for the useradd command Manpage icon.


[#36671] Monday, March 28, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rcraftemur

Total Points: 118
Total Questions: 119
Total Answers: 144

Location: Turks and Caicos Islands
Member since Sun, Mar 7, 2021
3 Years ago
;