-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprovision.sh
More file actions
36 lines (27 loc) · 809 Bytes
/
provision.sh
File metadata and controls
36 lines (27 loc) · 809 Bytes
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
36
#!/bin/bash
# Provision a server quickly with the basics (docker, docker-compose, python3 ... )
set -ex
> sshd_config cat <<EOF
PermitRootLogin no
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM yes
AllowAgentForwarding yes
X11Forwarding no
PrintMotd no
AcceptEnv LANG LC_*
EOF
sudo chown root:root sshd_config
sudo mv sshd_config /etc/ssh/sshd_config
if (( $(id -u) == 0 )); then
mkdir -p ~/.ssh
chmod 766 ~/.ssh
sudo cp /root/.ssh/authorized_keys ~/.ssh/authorized_keys
sudo chown ${USER}:${USER} ~/.ssh/authorized_keys
fi
sudo apt update
yes | sudo apt upgrade -y
sudo apt install -y git curl python3 python3-pip
curl https://get.docker.com | sh
sudo usermod -aG docker ${USER}
echo 'You will need to either reboot or logout for the docker permissions to work'