cleaner
This commit is contained in:
parent
0685e81bb0
commit
c7cf872d9c
@ -1,5 +1,13 @@
|
||||
#!/bin/bash
|
||||
echo INIIIIT
|
||||
echo " ------------------------------ init.sh file ------------------------------"
|
||||
|
||||
# Allow SSH as root
|
||||
if [ -z "$(grep '^PermitRootLogin yes' /etc/ssh/sshd_config)" ] ; then
|
||||
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
|
||||
fi
|
||||
|
||||
# set root passwd
|
||||
echo -e "root\nroot" | passwd
|
||||
|
||||
|
||||
echo " ------------------------------ init.sh end -------------------------------"
|
||||
|
@ -29,6 +29,7 @@ genPassowrd () {
|
||||
}
|
||||
if [ ! -f $PASSWD_LIST ] ; then
|
||||
for user in $(cat "$USERS_LIST") ; do
|
||||
if [ -z "$user" ] ; then continue ; fi
|
||||
echo "$user$separator$(genPassowrd 10)" >> $PASSWD_LIST
|
||||
done
|
||||
fi
|
||||
@ -37,18 +38,14 @@ fi
|
||||
for line in $(cat $PASSWD_LIST) ; do
|
||||
name="$(echo "$line" | cut -d "$separator" -f 1)"
|
||||
pass="$(echo "$line" | cut -d "$separator" -f 2)"
|
||||
if [ -z "$name" ] || [ -z "$pass" ] ; then echo "Malformed line skipped: '$line'" ; continue ; fi
|
||||
home="$HOME_BASE/$name"
|
||||
mkdir -p "$home"
|
||||
#useradd --home-dir "$home" --no-user-group -G eleve --shell /bin/bash --root "$home" "$name"
|
||||
useradd --home-dir "$home" --no-user-group -G eleve --shell /bin/bash "$name"
|
||||
echo "$pass\n$pass" | passwd "$name" &> /dev/null
|
||||
chown "$name":eleve "$home"
|
||||
done
|
||||
|
||||
# Allow SSH as root
|
||||
if [ -z "$(grep '^PermitRootLogin yes' /etc/ssh/sshd_config)" ] ; then
|
||||
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
|
||||
fi
|
||||
|
||||
echo "\nFin de la préparation des utilisateurs.\n"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user