File tree Expand file tree Collapse file tree 3 files changed +23
-37
lines changed Expand file tree Collapse file tree 3 files changed +23
-37
lines changed Original file line number Diff line number Diff line change @@ -7,48 +7,22 @@ This folder contains the scripts that streamline the setting up of a validator i
7
7
Before running any of the scripts, if you are starting from a new server as root, the first thing to do is to create a non-root user.
8
8
9
9
```
10
- USER=terrau
11
- useradd -m -s /bin/bash $USER
12
- usermod -aG sudo $USER
13
- # Set the password for the user.
14
- passwd $USER
10
+ export TERRA_USER=terrau
11
+ ./root1.sh
15
12
```
16
13
17
- Then copy the SSH keys that the root user accepts (if any).
14
+ Then copy the SSH keys that the root user accepts (if any) and enable the user to use ` sudo ` without entering a password .
18
15
19
16
```
20
- cp -r .ssh /home/$USER
21
- chown -R $USER:$USER /home/$USER/.ssh
22
- chmod 644 /home/$USER/.ssh/authorized_keys
17
+ ./root2.sh
23
18
```
24
19
25
- Enable the user to use sudo without entering a password.
26
-
27
- ```
28
- echo "$USER ALL=NOPASSWD: ALL" >> /etc/sudoers
29
- ```
30
-
31
- Recommended - change the default port and remove root SSH.
32
-
33
- ```
34
- # Port 8888
35
- # PermitRootLogin no
36
- # PasswordAuthentication no
37
- ```
38
-
39
- Then restart the server: ` systemctl restart sshd `
20
+ This script also makes changes to SSH default configurations and extends the resource limits.
40
21
41
22
Recommended - change the name of the machine to easily identify it.
42
23
43
24
sudo hostname {SERVER-NAME}
44
25
45
- Extend the limits for the server by appending the following to /etc/security/limits.conf
46
-
47
- ```
48
- * soft nofile 65535
49
- * hard nofile 65535
50
- ```
51
-
52
26
# start.sh
53
27
54
28
This script is to be run as a user in server. It downloads and sets up the software that is needed to get the validator running.
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- if [[ -z " ${TERRA_USER} " ]]; then
3
+ if [[ -z " ${TERRA_USER} " ]]
4
+ then
4
5
echo " ERROR: Environment variable 'TERRA_USER' must be defined first. E.g."
5
6
echo " export TERRA_USER=terrau"
6
7
exit
7
8
fi
8
9
9
- echo " > Copying SSH keys to new user account..."
10
+ if [[ -d /home/root/.ssh ]]
11
+ then
12
+ echo " > Copying SSH keys to new user account..."
10
13
11
- cp -r .ssh /home/$TERRA_USER
12
- chown -R $TERRA_USER :$TERRA_USER /home/$TERRA_USER /.ssh
13
- chmod 644 /home/$TERRA_USER /.ssh/authorized_keys
14
+ cp -r .ssh /home/$TERRA_USER
15
+ chown -R $TERRA_USER :$TERRA_USER /home/$TERRA_USER /.ssh
16
+ chmod 644 /home/$TERRA_USER /.ssh/authorized_keys
14
17
15
- echo " Done."
18
+ echo " Done."
19
+ fi
16
20
17
21
echo " > Enabling sudo without password..."
18
22
@@ -27,3 +31,11 @@ echo "* hard nofile 65535" >> /etc/security/limits.co
27
31
28
32
echo " Done."
29
33
34
+ echo " > Changing default SSH port, password login, and root configurations..."
35
+
36
+ echo " Port 9560" >> /etc/ssh/sshd_config
37
+ echo " PasswordAuthentication no" >> /etc/ssh/sshd_config
38
+ echo " PermitRootLogin no" >> /etc/ssh/sshd_config
39
+ systemctl restart sshd
40
+
41
+ echo " Done."
You can’t perform that action at this time.
0 commit comments