init script and mock data/passwords files

This commit is contained in:
Adrian Amaglio 2021-02-15 12:50:14 +01:00
parent 15a80a883c
commit e122d5a452
5 changed files with 14 additions and 1 deletions

View File

@ -15,7 +15,7 @@ docker run --name pythonsandbox --rm --network-mode host -v ./production_eleves:
The directory `data` must contain a `users.txt` containing one username per line, or a `passwords.txt` file, containing `username=password` lines. The directory `data` must contain a `users.txt` containing one username per line, or a `passwords.txt` file, containing `username=password` lines.
If you do not provide a password file, it will be generated from user file. If you do not provide a password file, it will be generated from user file.
The password file is the database from which users/passwords are created in the system. The password file is the database from which users/passwords are created in the system.
Additionnaly, you can add a file named `./data/init.sh` which will be executed before starting the servers. It is usefull for debuging or customisation purposes! Additionnaly, you can add a file named `./data/init.sh` which will be executed (as root) before starting the servers. It is usefull for debuging or customisation purposes!
## Use it ## Use it
You can now ssh into your localhost (and others computer on the same network can ssh into your host). You can now ssh into your localhost (and others computer on the same network can ssh into your host).

5
test-python-ssh/data/init.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo INIIIIT
# set root passwd
echo -e "root\nroot" | passwd

View File

@ -0,0 +1,2 @@
218-amine=TPA6eMfztS
218-chems=osjMQQ8rXd

View File

@ -0,0 +1,2 @@
218-amine
218-chems

View File

@ -47,6 +47,10 @@ for line in $(cat $PASSWD_LIST) ; do
chown "$name":eleve "$home" chown "$name":eleve "$home"
done done
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
echo "\nFin de la préparation des utilisateurs.\n"
# Custom script # Custom script
if [ -f "$CUSTOM_SCRIPT" ] ; then if [ -f "$CUSTOM_SCRIPT" ] ; then
if [ ! -x "$CUSTOM_SCRIPT" ] ; then if [ ! -x "$CUSTOM_SCRIPT" ] ; then