create users from a list via script
- script
user@cassandra ~/bin $
cat museradd.sh
#!/bin/bash # *********************** # museradd v0.0 16/01/018 # *********************** # moet gebruikt worden met sudo # # om multiple users aan te maken met bvb 2 x sdf12345 in passwfile # users in userfile ################################## while read gebruiker do echo $gebruiker useradd -m $gebruiker passwd $gebruiker < passwdfile done < userfile
- files
Create two textfiles:
userfile
contains a list of users (one per line)
passwdfile
contains a default password (twice becausepasswd
needs it twice)
user@cassandra ~ $
cat userfile
yoren waldo gunther lynn sarah
user@cassandra ~ $
cat passwdfile
qwerty123 qwerty132
- parameters
should be modified to use parameters foruserfile
andpasswdfile