-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdefault.sh
More file actions
executable file
·53 lines (43 loc) · 1.67 KB
/
default.sh
File metadata and controls
executable file
·53 lines (43 loc) · 1.67 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
echo "================== Reconfigure time zone ============"
dpkg-reconfigure tzdata
echo ""
echo "================== Update all packages: ==============="
apt-get update -y && apt-get upgrade -y && apt-get autoremove -y
apt-get install language-pack-fr -y
echo ""
echo "================== Install curl git nodejs ==========="
apt-get -y install curl python-software-properties git-core nodejs
echo ""
echo "================== Disable SSH password authentication ==============="
sed -i.bak -e "s/UsePAM yes/UsePAM no/g" /etc/ssh/sshd_config
sed -i.bak -e "s/#PasswordAuthentication yes/PasswordAuthentication no/g" /etc/ssh/sshd_config
echo ""
echo "================== Generate missing SSH host keys ==============="
/etc/init.d/ssh reload
ssh-keygen -A
echo ""
echo "================== Check the open portls (should be only SSH): ==============="
netstat --listening --tcp
echo ""
echo "================== Enable the Ubuntu firewall so that unconfigured services are not be exposed: ==============="
ufw allow 22 && ufw logging off && ufw enable && ufw status
echo ""
echo "================== Create User Rails ==============="
adduser rails --disabled-password
chown rails /srv/
echo ""
echo "================== Grant User Rails sudo ==============="
adduser rails sudo
echo -e "\nrails ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
echo ""
echo "================== Copy authorized_keys ==============="
mkdir /home/rails/.ssh
cp ~/.ssh/authorized_keys /home/rails/.ssh/
chown rails.rails /home/rails/.ssh -R
chmod go-rwx /home/rails/.ssh -R
echo ""
echo "================== Reboot ==============="
echo 'After reboot log with rails user'
reboot
echo ""