armbian.sh: Disable autologin, require root password and use passwd -l instead of nologin shell for root login prevention

Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
Signed-off-by: Tobias K <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
Tobias Knöppler 2024-04-28 18:40:05 +02:00 committed by Tobias K
parent a0c6b213e6
commit 78039d38d1
No known key found for this signature in database
GPG Key ID: 44FD368932E645C1
3 changed files with 17 additions and 1 deletions

View File

@ -39,6 +39,12 @@ run_app_unsafe post-inst.sh
# disable SSH by default, it can be enabled through ncp-web
systemctl disable ssh
# disable armbian autologin
rm -f /etc/systemd/system/getty@.service.d/override.conf
rm -f /etc/systemd/system/serial-getty@.service.d/override.conf
rm -f /root/.not_logged_in_yet
sed -i 's|^root::|root:x:|' /etc/passwd
basename "$IMG" | tee /usr/local/etc/ncp-baseimage
cd -

2
ncp.sh
View File

@ -82,7 +82,7 @@ EOF
echo -e "$WEBPASSWD\n$WEBPASSWD" | passwd "$WEBADMIN"
is_docker || is_lxc || {
chsh -s /usr/sbin/nologin "$WEBADMIN"
chsh -s /usr/sbin/nologin root
passwd -l root
}
## NCP LAUNCHER

10
updates/1.54.0.sh Normal file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
if getent passwd "$LOGNAME" | grep -e 'root' | grep -e '/usr/sbin/nologin'
then
chsh -s /bin/bash root
passwd -l root
fi
apt-get update
apt-get install --no-install-recommends -y tmux