Search code examples
linuxmacosunixoperating-systemcomputer-science

Unix(BSD Unix, MacOSX) vs Linux login setuid bit difference


Under Unix (for example BSD Unix, MacOSX) the login program has the setuid bit set. In Linux login does not have the setuid bit set. The questions is about /bin/login .

What are the differences between the two architectural decisions and why Linux doesn't have to do it? How does it solve the permissions' problem?

I've seen this as a CS questions somewhere and I can't figure out the answer. So please feel free to help.

Thanks in Advance!


Solution

  • In Linux you normally have a bunch of getty (text console) processes and/or a display manager (graphical) login process running with root privileges. When creating a user session, these are calling /bin/login, still with root privileges. login then drops the privileges by changing the UID/GID and execv-ing the login shell, or launching the graphical session.