mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
fix firstlogin failed to create password on sid
This commit is contained in:
@@ -746,9 +746,17 @@ if [[ -f /root/.not_logged_in_yet && -n $(tty) ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# only allow one login. Once you enter root password, kill others.
|
||||
loginfrom=$(who am i | awk '{print $2}')
|
||||
who -la | grep root | grep -v "$loginfrom" | awk '{print $7}' | xargs --no-run-if-empty kill -9
|
||||
# Get current session identifiers
|
||||
current_tty=$(tty | sed 's:/dev/::') # e.g., "tty1"
|
||||
current_pid=$$
|
||||
|
||||
# Kill ONLY other active root SHELL sessions (not login processes)
|
||||
ps -u root -o pid,tty,comm |
|
||||
awk -v me="$current_tty" -v mypid="$current_pid" '
|
||||
NR>1 && $2 != "?" && $2 != me && $1 != mypid && $3 ~ /sh$/ {
|
||||
print $1
|
||||
}' |
|
||||
xargs --no-run-if-empty kill -9
|
||||
|
||||
# enable motd
|
||||
chmod +x /etc/update-motd.d/*
|
||||
|
||||
Reference in New Issue
Block a user