Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Usually, your terminal emulator will create a login shell by default when you open a new terminal window. (Apple Terminal and iTerm2 both do.) And that’s generally the only time you create a login shell.

On a Linux system, login shells are only invoked when you actually create a new session which doesn't come from an existing session belonging to the same user. In other words, you get the when

  - you switch to a 'real' TTY and log in manually
  - you log in via your GUI session manager (GDM, SDDM, etc.)
  - you log in remotely, e.g., via SSH
But not when you open a new terminal emulator window. You can't just run `login` as your normal user inside a terminal emulator and get a new session either. You can check this with `finger` or `loginctl list-sessions`.

On macOS, those things do get you new sessions which are shown by `finger`. I wonder whether the difference reveals a macOS quirk or a Linux quirk.



Wow I don't know what's crazier... that OS X still has finger or that it's had it this whole time and I never noticed. I remember fondly the early days of the internet when "finger `cat /etc/passwd`@remotehost" and other similar types of exploits had ridiculously high hit rates. And of course no shadowed password files yet.


I think this is because launchd+getty and systemd+agetty are doing something similar in those circumstances? They're both opening pseudo-terminals with the login command. That is to say, opening Terminal.app connects to a 'network' PTS much like SSH does, afaict.


Yeah but I wonder why. (Invoking `login` at the CLI in Terminal.app yields the same result as opening a new tab on macOS.) Trying the same on Linux says you have to be root, and does not log you in.

Anyone got a Linux distro configured differently that they can explain, or a *BSD they care to try and compare on? Is there any reason (security, 'correctness') to prefer one way over the other?




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: