What happens when you log in?

Updated: May 06, 2022

You typically start a session on the computer by logging in; the configuration of your account determines what happens then.

When you log in, the system creates a user session led by a process that runs under your user ID and default group ID, as determined from your account entry in /etc/passwd.

The user ID and group ID determine the permission the process has to access files and system resources. In addition, if the process creates any files and directories, they belong to that user and group. Each new process that you start inherits your user ID and group ID from its parent process. For more information about file permissions, see File ownership and permissions in Working with Files.

Note: For more information on characteristics that programs inherit from their parent programs, see spawn() in the QNX Neutrino C Library Reference. For more information on sessions and process groups, see IEEE Std 1003.1-2001 Standard for Information Technology Portable Operating System Interface.

When you log in via the login utility, login changes directory to your HOME directory; it also sets LOGNAME to your user name and SHELL to the login shell named in your account. It then starts the login shell, which is typically a command interpreter (/bin/sh), but could also be an application that gets launched as soon as you log in.