When will login terminate?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
When starting up an OS, getty and login are run. It seems that login will continuously run after finish logging in.
There is no logout command. I wonder when login will terminate running, except when shut down the OS?
Btw, is it correct that login only runs on text console, not when starting X windows and a display manager and a desktop environment?
Thanks.
linux login
add a comment |Â
up vote
0
down vote
favorite
When starting up an OS, getty and login are run. It seems that login will continuously run after finish logging in.
There is no logout command. I wonder when login will terminate running, except when shut down the OS?
Btw, is it correct that login only runs on text console, not when starting X windows and a display manager and a desktop environment?
Thanks.
linux login
See also unix.stackexchange.com/questions/194197 and unix.stackexchange.com/questions/255385.
â JdeBP
May 4 at 23:54
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
When starting up an OS, getty and login are run. It seems that login will continuously run after finish logging in.
There is no logout command. I wonder when login will terminate running, except when shut down the OS?
Btw, is it correct that login only runs on text console, not when starting X windows and a display manager and a desktop environment?
Thanks.
linux login
When starting up an OS, getty and login are run. It seems that login will continuously run after finish logging in.
There is no logout command. I wonder when login will terminate running, except when shut down the OS?
Btw, is it correct that login only runs on text console, not when starting X windows and a display manager and a desktop environment?
Thanks.
linux login
asked May 3 at 23:58
Tim
22.6k63223401
22.6k63223401
See also unix.stackexchange.com/questions/194197 and unix.stackexchange.com/questions/255385.
â JdeBP
May 4 at 23:54
add a comment |Â
See also unix.stackexchange.com/questions/194197 and unix.stackexchange.com/questions/255385.
â JdeBP
May 4 at 23:54
See also unix.stackexchange.com/questions/194197 and unix.stackexchange.com/questions/255385.
â JdeBP
May 4 at 23:54
See also unix.stackexchange.com/questions/194197 and unix.stackexchange.com/questions/255385.
â JdeBP
May 4 at 23:54
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
5
down vote
login terminates when its child (the logged-in userâÂÂs login shell) terminates. It could even exec the child without forking, replacing itself, but it needs to take care of PAM session clean-up, so it has to wait for its child instead. Once it terminates, getty or init (more generally, the init process) do some more clean-up (utmp etc.) and wait for a new login (if getty replaced itself with login, or exits when login terminates, the init process will start a new getty).
YouâÂÂre right, under Linux at least, login is generally only used on virtual consoles (or real terminals connected via serial devices). Graphical display managers implement their own login mechanisms. You can run login inside a login shell, e.g. in a terminal emulator, with a little care (exec login); a long time ago, recursive login was used to change users, the equivalent of su nowadays.
Note that some shells do have a logout command, which is supposed to be used instead of exit to exit a login shell; in such shells, exit typically wonâÂÂt exit from a login shell.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
login terminates when its child (the logged-in userâÂÂs login shell) terminates. It could even exec the child without forking, replacing itself, but it needs to take care of PAM session clean-up, so it has to wait for its child instead. Once it terminates, getty or init (more generally, the init process) do some more clean-up (utmp etc.) and wait for a new login (if getty replaced itself with login, or exits when login terminates, the init process will start a new getty).
YouâÂÂre right, under Linux at least, login is generally only used on virtual consoles (or real terminals connected via serial devices). Graphical display managers implement their own login mechanisms. You can run login inside a login shell, e.g. in a terminal emulator, with a little care (exec login); a long time ago, recursive login was used to change users, the equivalent of su nowadays.
Note that some shells do have a logout command, which is supposed to be used instead of exit to exit a login shell; in such shells, exit typically wonâÂÂt exit from a login shell.
add a comment |Â
up vote
5
down vote
login terminates when its child (the logged-in userâÂÂs login shell) terminates. It could even exec the child without forking, replacing itself, but it needs to take care of PAM session clean-up, so it has to wait for its child instead. Once it terminates, getty or init (more generally, the init process) do some more clean-up (utmp etc.) and wait for a new login (if getty replaced itself with login, or exits when login terminates, the init process will start a new getty).
YouâÂÂre right, under Linux at least, login is generally only used on virtual consoles (or real terminals connected via serial devices). Graphical display managers implement their own login mechanisms. You can run login inside a login shell, e.g. in a terminal emulator, with a little care (exec login); a long time ago, recursive login was used to change users, the equivalent of su nowadays.
Note that some shells do have a logout command, which is supposed to be used instead of exit to exit a login shell; in such shells, exit typically wonâÂÂt exit from a login shell.
add a comment |Â
up vote
5
down vote
up vote
5
down vote
login terminates when its child (the logged-in userâÂÂs login shell) terminates. It could even exec the child without forking, replacing itself, but it needs to take care of PAM session clean-up, so it has to wait for its child instead. Once it terminates, getty or init (more generally, the init process) do some more clean-up (utmp etc.) and wait for a new login (if getty replaced itself with login, or exits when login terminates, the init process will start a new getty).
YouâÂÂre right, under Linux at least, login is generally only used on virtual consoles (or real terminals connected via serial devices). Graphical display managers implement their own login mechanisms. You can run login inside a login shell, e.g. in a terminal emulator, with a little care (exec login); a long time ago, recursive login was used to change users, the equivalent of su nowadays.
Note that some shells do have a logout command, which is supposed to be used instead of exit to exit a login shell; in such shells, exit typically wonâÂÂt exit from a login shell.
login terminates when its child (the logged-in userâÂÂs login shell) terminates. It could even exec the child without forking, replacing itself, but it needs to take care of PAM session clean-up, so it has to wait for its child instead. Once it terminates, getty or init (more generally, the init process) do some more clean-up (utmp etc.) and wait for a new login (if getty replaced itself with login, or exits when login terminates, the init process will start a new getty).
YouâÂÂre right, under Linux at least, login is generally only used on virtual consoles (or real terminals connected via serial devices). Graphical display managers implement their own login mechanisms. You can run login inside a login shell, e.g. in a terminal emulator, with a little care (exec login); a long time ago, recursive login was used to change users, the equivalent of su nowadays.
Note that some shells do have a logout command, which is supposed to be used instead of exit to exit a login shell; in such shells, exit typically wonâÂÂt exit from a login shell.
edited May 4 at 17:33
JdeBP
28.1k459133
28.1k459133
answered May 4 at 5:18
Stephen Kitt
140k22302363
140k22302363
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441678%2fwhen-will-login-terminate%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
See also unix.stackexchange.com/questions/194197 and unix.stackexchange.com/questions/255385.
â JdeBP
May 4 at 23:54