I'm playing around, and trying to streamline/harden my tty login prompt to display a minimum of system information. I modified my /etc/issue and /etc/motd to be empty, and touched ~/.hushlogin. That cleared almost everything away!
I was left with the following as a login experience:
hostname login: user
Password:
user@hostname:~$
I dislike that it shows the hostname at the login prompt though, and I chased that down. This led me to the man page for agetty, where I modified the service files:
/lib/systemd/system/serial-getty@.service, and
/lib/systemd/system/getty@.service,
adding the --nohostname option to the ExecStart line as so:
[Service]
ExecStart=-/sbin/agetty --nohostname --keep-baud 115200,38400,9600 %I $TERM
This works great, except, when the user enters a wrong password. Then it reverts to the old prompt and shows the hostname.
Successful login:
login: user
Password:
user@hostname:~$
Failed login:
login: user
Password:
Login incorrect
hostname login:
Even weirder, if I leave the console unattended for ~60 seconds after the incorrect login, there's a half-print of the word login, it pauses, then shows the correct login prompt.
login: user
Password:
Login incorrect
hostname login:
Log
login:
Any ideas explaining this behavior? I looked at the source for agetty, and then for shadow (login.c), and I can see where the re-display of the login prompt happens after a fail, but it's referencing PAMs, and I don't really understand that part of the linux system.