init script and mock data/passwords files
This commit is contained in:
parent
15a80a883c
commit
e122d5a452
@ -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
5
test-python-ssh/data/init.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo INIIIIT
|
||||||
|
|
||||||
|
# set root passwd
|
||||||
|
echo -e "root\nroot" | passwd
|
2
test-python-ssh/data/passwords.txt
Normal file
2
test-python-ssh/data/passwords.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
218-amine=TPA6eMfztS
|
||||||
|
218-chems=osjMQQ8rXd
|
2
test-python-ssh/data/users.txt
Normal file
2
test-python-ssh/data/users.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
218-amine
|
||||||
|
218-chems
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user