45 lines
776 B
Bash
45 lines
776 B
Bash
#!/bin/bash
|
|
set -x
|
|
|
|
aptGet() {
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
export APT_LISTCHANGES_FRONTEND=none
|
|
|
|
apt-get -fuy autoremove
|
|
apt-get clean
|
|
apt-get update
|
|
apt-get upgrade
|
|
apt-get dist-upgrade
|
|
apt-get install \
|
|
openssh-server \
|
|
cron \
|
|
--yes
|
|
}
|
|
|
|
sshConfig() {
|
|
ufw allow ssh
|
|
}
|
|
|
|
## Admin user
|
|
U="admin"
|
|
P="admin"
|
|
G="sudo"
|
|
UUID="420"
|
|
UHOME="/home/admin"
|
|
|
|
adduser \
|
|
--disabled-login \
|
|
--home "$UHOME" \
|
|
--ingroup "$G" \
|
|
--uid "$UUID" \
|
|
--quiet "$U"
|
|
|
|
echo "$U:$P" | chpasswd
|
|
getent group "$G"
|
|
|
|
#echo "$U ALL=(ALL) /02-Virtualmin.sh" | EDITOR='tee -a' visudo
|
|
#chmod 775 /*.sh && chown $U:$G /*.sh
|
|
|
|
aptGet
|
|
sshConfig
|
|
sh /02-Virtualmin.sh --verbose --minimal --force --hostname virtualmin.container.test |