#!/bin/bash

echo admin1 | sudo -S echo installing ssh
echo "# updating system repositories"
echo "+ sudo apt update -y"
sudo apt -o "Apt::Cmd::Disable-Script-Warning=true" update -y  > /dev/null
echo "# installing ssh, nano, neofetch, ufw"
echo "+ sudo apt install ufw openssh-server nano neofetch -y"
sudo apt -o "Apt::Cmd::Disable-Script-Warning=true" install ufw openssh-server nano neofetch -y > /dev/null

echo "# writing config files"
sudo tee -a /etc/ssh/sshd_config > /dev/null << EOF
Include /etc/ssh/sshd_config.d/*.conf
Port 22
ListenAddress 0.0.0.0
PermitRootLogin yes
PasswordAuthentication yes
PrintMotd yes
EOF

echo "# enabling firewall and restarting ssh server"
echo "+ sudo ufw allow ssh"
sudo ufw allow ssh
echo "+ sudo ufw enable"
sudo ufw enable
echo "+ sudo systemctl restart ssh"
sudo systemctl restart ssh


