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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# only allow one login. Once you enter root password, kill others.
|
# Get current session identifiers
|
||||||
loginfrom=$(who am i | awk '{print $2}')
|
current_tty=$(tty | sed 's:/dev/::') # e.g., "tty1"
|
||||||
who -la | grep root | grep -v "$loginfrom" | awk '{print $7}' | xargs --no-run-if-empty kill -9
|
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
|
# enable motd
|
||||||
chmod +x /etc/update-motd.d/*
|
chmod +x /etc/update-motd.d/*
|
||||||
|
|||||||
Reference in New Issue
Block a user