In
this tutorial you will learn how to create bulk linx user and password using
shell script.
Create a
user list
#vim
userlist
test1
test2
test3
test4
test5
Now, create
a script file
#vim
useradd.sh
#/bin/bash
for i in
`cat /root/userlist`
do
useradd $i
echo
"User $i create successfully"
done
give excute permisstion to script
file
# chmod o+x
user.sh
Now run script
#./ user.sh
As you seen
above users created successfully. Now set password for created user.
Create script to generate users
password
#vim pass.sh
#!/bin/sh
for i in `cat
userlist.txt `
do
echo
$i"@123" | passwd --stdin "$i"
echo
"Password changed for $i "
done
Note: password
for each user is username@123
Now run script to generate
password
# chmod o+x pass.sh
#./pass.sh
0 comments:
Post a Comment