#!/bin/bash USERNAME=usradmin SSH_PORT=2525 if [ "$(id -u)" != "0" ]; then echo -e "\033[31mThis script requires superuser rights.\033[0m" exit 0 fi trap 'echo -e "\033[31mSomething went wrong\033[0m"; exit 1' ERR set -e export DEBIAN_FRONTEND=noninteractive apt update -y apt upgrade -y apt install -y mc vim zip pwgen timedatectl set-timezone Asia/Yekaterinburg echo "Timezone changed:" timedatectl if id "$USERNAME" &>/dev/null; then echo "User $USERNAME already exists" else useradd -m -s /bin/bash "$USERNAME" usermod -aG sudo "$USERNAME" fi chown "$USERNAME":"$USERNAME" /data chmod 770 /data mkdir -p /backups chown "$USERNAME":"$USERNAME" /backups chmod 770 /backups # SSH config: cd /data/utils bash ssh-port.sh $SSH_PORT #bash ssh-pw.sh n trap - ERR echo "Init complete"