Stay at Home!! Be Safe!! Take Care!!

For Any queries, please mail us at support@funoracleapps.com

Linux Shell Script to Create Multiple User, Set Password and Expire Password

No comments

Linux Shell Script to create Multiple Users and Expire Password


Example Script to create multiple users in linux at same time.Remember this has to be executed via administrative user or root.


for u in kevin nancy scott ; do
useradd $u
echo "$u:Password1" | chpasswd
passwd -e $u
done

We can also create a file and pass any number of users.

Sample file

$ cat newusers

himanshu
kevin
bob
marley
nancy


for u in `cat newusers` ; do
useradd $u
echo "$u:Password1" | chpasswd
passwd -e $u
done

No comments :

Post a Comment