From 1919e4a8903254978be8b0734c01947744315f41 Mon Sep 17 00:00:00 2001 From: Support Date: Thu, 4 Dec 2025 20:04:40 +0000 Subject: [PATCH] Add server-side/step1_as_root.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the first initial setup to be run as the root user of a brand new server for a HydraVeil Node. It sets up a Linux user, git, curl, and fixes the DNS. These can be done on your own, if you know what you’re doing or follow our guides. --- server-side/step1_as_root.sh | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 server-side/step1_as_root.sh diff --git a/server-side/step1_as_root.sh b/server-side/step1_as_root.sh new file mode 100644 index 0000000..6cb24f0 --- /dev/null +++ b/server-side/step1_as_root.sh @@ -0,0 +1,63 @@ +#!/bin/bash -eu + +# Ensure the script runs with root privileges +if [ "$EUID" -ne 0 ]; then + echo "Please run this script as root" + exit 1 +fi +#################### +sudo apt update && sudo apt upgrade +# Install curl & git for later: +sudo apt install curl git -y +############################################################################ +# # +# setup a Linux user # +# # +############################################################################ +read -p "Enter a linux username to make: " LINUX_USERNAME +export LINUX_USERNAME=$LINUX_USERNAME +read -p "Enter a password for $LINUX_USERNAME: " LINUX_PASSWORD +export LINUX_PASSWORD=$LINUX_PASSWORD +# setup: +useradd $LINUX_USERNAME +mkdir /home/$LINUX_USERNAME +chown $LINUX_USERNAME:$LINUX_USERNAME /home/$LINUX_USERNAME -R +# activate linux shell for the user: +look_for="/home/$LINUX_USERNAME:/bin/sh" +change_to="/home/$LINUX_USERNAME:/bin/bash" +sudo sed -i "s|$look_for|$change_to|g" /etc/passwd +# Change the password +echo "$LINUX_USERNAME:$LINUX_PASSWORD" | chpasswd +# Verify the change +if [ $? -eq 0 ]; then + echo "Password set successfully for user $LINUX_USERNAME." +else + echo "Failed to set password for user $LINUX_USERNAME." +fi +# Make a sudo user: +usermod -aG sudo $LINUX_USERNAME +############################################################################ +# # +# DNS, undo google. undo cloudflare # +# # +############################################################################ +sudo sed -i 's/1.1.1.1/9.9.9.9/g' /etc/network/if-up.d/custom-resolv +sudo sed -i 's/8.8.8.8/9.9.9.10/g' /etc/network/if-up.d/custom-resolv +sudo sed -i 's/1.1.1.1/9.9.9.9/g' /etc/netplan/50-cloud-init.yaml +sudo sed -i 's/8.8.8.8/9.9.9.10/g' /etc/netplan/50-cloud-init.yaml +sudo sed -i 's/1.1.1.1/9.9.9.9/g' /etc/resolv.conf +sudo sed -i 's/8.8.8.8/9.9.9.10/g' /etc/resolv.conf +sudo sudo apt install dnsutils -y +dig +read -p "do you see google or cloudflare in the above DNS servers? (yes/no): " REPLY_ON_GOOGLE_CLOUDFLARE +# Check the user's answer +if [[ "$REPLY_ON_GOOGLE_CLOUDFLARE" == "yes" ]]; then + echo "This means you need to reboot for it to take effect. Rebooting now" + reboot +elif [[ "$REPLY_ON_GOOGLE_CLOUDFLARE" == "no" ]]; then + echo "ok great. you don't need to reboot" + # switch to the user: + su $LINUX_USERNAME +else + echo "Please answer with 'yes' or 'no'." +fi