-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_vps.sh
More file actions
executable file
·40 lines (22 loc) · 1.22 KB
/
setup_vps.sh
File metadata and controls
executable file
·40 lines (22 loc) · 1.22 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
#!/usr/bin/env bash
set -x
## Add User Stuff
apt-get install -y vim ncal command-not-found ufw fail2ban
useradd -m blue
usermod -a -G blue sudo
## Setup User
chsh -s /bin/bash blue
## UFW Setup
ufw allow ssh
ufw enable
## Fail2ban
cp /etc/fail2ban/fail2ban.conf /etc/fail2ban/fail2ban.local
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
## SSH Stuff
mkdir /home/blue/.ssh
chmod 750 /home/blue/.ssh
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0NLK7075DSCgPzNH7srVO0tYCyQwlkI8D9hEnTnWnq2t1y/uIGZWmW5WJ268HTA358fkxGOC4+WRWTFLDdUluKbxNoppk1FON7UitAFhl/Pp3N2WUw8JF80Hc0QJtjDYDn+y24N5gfSkIHHIsduE900YuvluFynVALOXoyz5Q3y1l9/MP1K7pD9jTO7MJx2bNsJDkN1kxcC+8ByJ3L2IpqI5UGtJmHLS1ozDvzMc5+h5ElKf5wySA4yeOKseH0TX9O7y9EloSeuuajO7t2pL2of4lZauBmigQH2nAC99KyLiRcW4Fbzf4yNOy/i69NYB4sH1nVTgFRZBYqMVf13b/ bluesoldier23@HomeDesktop' > /home/blue/.ssh/authorized_keys
chmod 600 /home/blue/.ssh/authorized_keys
sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/#AuthorizedKeysFile .ssh\/authorized_keys .ssh\/authorized_keys2/AuthorizedKeysFile .ssh\/authorized_keys .ssh\/authorized_keys2/' /etc/ssh/sshd_config
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config