-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.sh
35 lines (32 loc) · 1.31 KB
/
config.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
# Add teacher profile
useradd -m "teacher"
# Set password
echo "teacher:teacher" | chpasswd
# Force password change on login
chage -d 0 teacher
# Execute DVNG start.py on login
echo "sudo PYTHONPATH=/vagrant /usr/bin/python /vagrant/start.py teacher" >> /home/teacher/.profile
# Make it so no welcome message is displayed upon login
touch /home/teacher/.hushlogin
# Then logout
echo "read -p 'Press enter to continue'" >> /home/teacher/.profile
echo "exit 0" >> /home/teacher/.profile
# Allow user of sudo, required for containernet
echo "teacher ALL=NOPASSWD: ALL" >> /etc/sudoers
# Add student profile in a similar manner
useradd -m "student"
echo "student:student" | chpasswd
echo "sudo PYTHONPATH=/vagrant /usr/bin/python /vagrant/start.py student" >> /home/student/.profile
touch /home/student/.hushlogin
echo "read -p 'Press enter to continue'" >> /home/student/.profile
echo "exit 0" >> /home/student/.profile
echo "student ALL=NOPASSWD: ALL" >> /etc/sudoers
# Configure ssh to allow password logins for these accounts
echo "Match User teacher,student" >> /etc/ssh/sshd_config
echo " PasswordAuthentication yes" >> /etc/ssh/sshd_config
service ssh reload
# Update pip
pip install -U pip
# Install required python modules
pip2 install -U networkx python-docx matplotlib pyftpdlib typing sphinx sphinx_rtd_theme