I try to call
/usr/bin/agetty - from bash in a terminal-emulator(both X-based and Kernel-based), then it asked me to input a username, but after input that username, it just "freeze" a little while, then dropped me back into my original bash promote.
I started to wonder, agetty is started by
systemd as a service using the ttyx device and
execve(/usr/bin/login) so it will give me login promote, because login is configured with
pam_systemd, so a systemd session will be created. But that's not the result I get when I directly run
agetty - as I mentioned above, no new session is created when I check
Then I thought if it was because agetty run as normal user, it might check its own EUID or something, but that just cause my bash to exit after I input the username.
Ok, I checked
systemctl status again, it told me systemd run this program as
/sbin/agetty -o -p -- \u --noclear tty2 linux, ok, I login as root on tty2, then run
agetty -o -p -- \u --noclear - linux, I got exactly the same situation as in the first place —— I was dropped back to bash again.
I need to understand these experiment results.
I'm using ArchLinux,
/usr/bin/agetty are both from the
util-linux 2.33-2 package.