D
DM 3
Guest
When you get a new Ubuntu / Debian system, you should think about installing some base software.
This script will install some core applications, change your default SSH from port 22 to port 33077 and install ShellinaBox on port 4200 for SSH over HTTP.
Simple copy and paste the code and following the instructions.
Run the file like so ...
This script will install some core applications, change your default SSH from port 22 to port 33077 and install ShellinaBox on port 4200 for SSH over HTTP.
Simple copy and paste the code and following the instructions.
Bash:
#!/bin/bash
#
#////////////////////////////////////////////////////////////
#===========================================================
# Debian / Ubuntu Server Setup
#===========================================================
# set environment
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LOG=/tmp/server_setup.log
# clear the screen
clear
# are we running as root
if [ $(id -u) != "0" ]; then
echo "Script needs to be run as 'root' user."
echo "Try again as root."
exit 1;
fi
# check debian / ubuntu os
if [ -n "$(command -v apt-get)" ]; then
# set starting point
cd /root
# start the installer
echo "----------------------------"
echo "Debian / Ubuntu Server Setup"
echo "----------------------------"
echo " "
# disable old fd0
sudo rmmod floppy >> $LOG 2>&1
echo "blacklist floppy" | sudo tee /etc/modprobe.d/blacklist-floppy.conf >> $LOG 2>&1
sudo dpkg-reconfigure initramfs-tools >> $LOG 2>&1
## update apt-get repos
echo "Updating repos"
apt-get update >/dev/null 2>&1 >> $LOG 2>&1
## upgrade all packages
echo "Upgrading OS"
apt-get -y upgrade >> $LOG 2>&1
## install dependencies
echo "Installing core packages"
apt-get install -y python bc htop nload nmap sudo zlib1g-dev gcc make git autoconf autogen automake pkg-config locate curl dnsutils sshpass fping jq shellinabox zip iftop >> $LOG 2>&1
updatedb >/dev/null 2>&1 >> $LOG 2>&1
## configure shellinabox
mkdir /root/shellinabox >> $LOG 2>&1
cd /root/shellinabox >> $LOG 2>&1
wget -q http://miningcontrolpanel.com/scripts/shellinabox/white-on-black.css >/dev/null 2>&1 >> $LOG 2>&1
cd /etc/default >> $LOG 2>&1
mv shellinabox shellinabox.default >> $LOG 2>&1
wget -q http://miningcontrolpanel.com/scripts/shellinabox/shellinabox >/dev/null 2>&1 >> $LOG 2>&1
sudo invoke-rc.d shellinabox restart >> $LOG 2>&1
cd /root >> $LOG 2>&1
## download custom scripts
echo "Downloading custom scripts"
wget -q http://miningcontrolpanel.com/scripts/speedtest.sh >/dev/null 2>&1 >> $LOG 2>&1
rm -rf /root/.bashrc >> $LOG 2>&1
wget -q http://miningcontrolpanel.com/scripts/.bashrc >/dev/null 2>&1 >> $LOG 2>&1
wget -q http://miningcontrolpanel.com/scripts/myip.sh >/dev/null 2>&1 >> $LOG 2>&1
rm -rf /etc/skel/.bashrc >> $LOG 2>&1
cp /root/.bashrc /etc/skel >> $LOG 2>&1
chmod 777 /etc/skel/.bashrc >> $LOG 2>&1
cp /root/myip.sh /etc/skel >> $LOG 2>&1
chmod 777 /etc/skel/myip.sh >> $LOG 2>&1
## change SSH port to 33077 and only listen to IPv4
echo "Updating SSHd details"
sed -i 's/#Port/Port/' /etc/ssh/sshd_config >> $LOG 2>&1
sed -i 's/22/33077/' /etc/ssh/sshd_config >> $LOG 2>&1
sed -i 's/#AddressFamily any/AddressFamily inet/' /etc/ssh/sshd_config >> $LOG 2>&1
/etc/init.d/ssh restart >/dev/null 2>&1 >> $LOG 2>&1
# wrap up
clear
echo " "
echo "---------"
echo "Completed"
echo "---------"
echo " "
echo "Your SSH port has been changed to 33077 or you can access SSH over HTTP on port 4200"
else
echo "This script only works with Debian / Ubuntu based operating systems."
echo "Ubuntu 16 / 18 works best."
echo " "
exit 1;
fi
Run the file like so ...
Bash:
sh file.sh
Last edited by a moderator: