Skip to content
Snippets Groups Projects
Verified Commit cc775826 authored by Laurent Modolo's avatar Laurent Modolo
Browse files

add first version of script to create user and passwrd from list of user mails

parent 053795ca
Branches
No related tags found
No related merge requests found
#! /usr/bin/bash
# USAGE
#wget -qO - http://perso.ens-lyon.fr/laurent.modolo/R/create_users_from_mail.sh | bash -s usertest@mail.fr usertest2@mail.f
#bash -c "$(wget -qO - 'http://perso.ens-lyon.fr/laurent.modolo/R/create_users_from_mail.sh')" '' usertest@mail.fr usertest2@mail.fr
USERMAILS=$@
for USERMAIL in ${USERMAILS[@]}
do
USERNAME=$(echo ${USERMAIL} | sed -E 's/(.*)@.*/\1/')
adduser ${USERNAME} --gecos 'First Last,RoomNumber,WorkPhone,HomePhone' --disabled-password
PASSWD=$(openssl rand -base64 20)
echo "${USERNAME}:${PASSWD}" | chpasswd
echo "======================================================================="
echo "${USERMAIL}:"
echo "${USERNAME}"
echo "${PASSWD}"
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment