From 1762818321f4154dd59a63c146678002012c9d9b Mon Sep 17 00:00:00 2001
From: Laurent Modolo <laurent.modolo@ens-lyon.fr>
Date: Mon, 20 Sep 2021 10:16:28 +0200
Subject: [PATCH] create_users_from_mail.sh: improve account creation script
 (no badname error and shorted pwd)

---
 CONTRIBUTING.md               | 1 +
 src/create_users_from_mail.sh | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index a26c378..f6b5a40 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -3,6 +3,7 @@
 ## Session 1
 - add tuto on how to connect to the Rstudio server hosted at the IFB
 
+
 ## All sessions
 - Write summary of all the commands at the end (what should have been written in the .R file during the session)
 
diff --git a/src/create_users_from_mail.sh b/src/create_users_from_mail.sh
index dad1e48..2f1fbf0 100755
--- a/src/create_users_from_mail.sh
+++ b/src/create_users_from_mail.sh
@@ -7,9 +7,9 @@ USERMAILS=$@
 for USERMAIL in ${USERMAILS[@]}
 do
   USERNAME=$(echo ${USERMAIL} | sed -E 's/(.*)@.*/\1/')
-  adduser ${USERNAME} --gecos 'First Last,RoomNumber,WorkPhone,HomePhone' --disabled-password
+  adduser ${USERNAME} --gecos 'First Last,RoomNumber,WorkPhone,HomePhone' --disabled-password --force-badname > /dev/null
   PASSWD=$(openssl rand -base64 10)
-  echo "${USERNAME}:${PASSWD}" | chpasswd
+  echo "${USERNAME}:${PASSWD}" | chpasswd > /dev/null
   echo "======================================================================="
   echo "${USERMAIL}:"
   echo "${USERNAME}"
-- 
GitLab