What does the Unix login program/command do?2019 Community Moderator ElectionDoes a shell automatically connect file descriptors 0, 1 and 2 to its controlling terminal?Where does UNIX look for login information? eg where it finds what to do?What does the command “$()” do in UNIX?Is the FreeBSD login program compatible with AFS?What does the parenthesis mean in a command description like “mklost+found(8)”how to test login command in unix using shell script?How does the Linux login work?What do these arguments to the login command do?What was the first Unix platform to have the 'yes' command?Run command after loginRe-login command?
CLI: Get information Ubuntu releases
Does fire aspect on a sword, destroy mob drops?
Exit shell with shortcut (not typing exit) that closes session properly
How can I create URL shortcuts/redirects for task/diff IDs in Phabricator?
Knife as defense against stray dogs
What is the reasoning behind standardization (dividing by standard deviation)?
Exposing a company lying about themselves in a tightly knit industry: Is my career at risk on the long run?
Error in master's thesis, I do not know what to do
Do people actually use the word "kaputt" in conversation?
Is VPN a layer 3 concept?
Why doesn't the chatan sign the ketubah?
Animating wave motion in water
Would this string work as string?
What are the rules for concealing thieves' tools (or items in general)?
How old is Nick Fury?
Have any astronauts/cosmonauts died in space?
PTIJ: Which Dr. Seuss books should one obtain?
Is there any common country to visit for uk and schengen visa?
Interior of Set Notation
Are hand made posters acceptable in Academia?
Weird lines in Microsoft Word
What is it called when someone votes for an option that's not their first choice?
How can an organ that provides biological immortality be unable to regenerate?
Symbolism of 18 Journeyers
What does the Unix login program/command do?
2019 Community Moderator ElectionDoes a shell automatically connect file descriptors 0, 1 and 2 to its controlling terminal?Where does UNIX look for login information? eg where it finds what to do?What does the command “$()” do in UNIX?Is the FreeBSD login program compatible with AFS?What does the parenthesis mean in a command description like “mklost+found(8)”how to test login command in unix using shell script?How does the Linux login work?What do these arguments to the login command do?What was the first Unix platform to have the 'yes' command?Run command after loginRe-login command?
I am reading APUE and it keeps refering to the login program, but I still don't know what it is doing in my operating system (Ubuntu).
§8.11:
Normally, the real user ID is set by the
login(1)program when we log in and never changes. Becauseloginis a superuser process, it sets all three user IDs when it calls setuid
ps aux | grep login:
root 840 0.0 0.0 70732 6120 ? Ss 15:13 0:00 /lib/systemd/systemd-logind
root 1120 0.0 0.0 419680 9468 ? Sl 15:13 0:00 gdm-session-worker [pam/gdm-autologin]
tianhe 1151 0.0 0.1 445184 20540 ? SLl 15:13 0:05 /usr/bin/gnome-keyring-daemon --daemonize --login
tianhe 10838 0.0 0.0 21536 1060 pts/0 S+ 21:50 0:00 grep --color=auto login
So in short, what functionality does this login program provide for the OS?
Under what circumstances it is used or run?
Btw, how is login compared to ssh?
login command
add a comment |
I am reading APUE and it keeps refering to the login program, but I still don't know what it is doing in my operating system (Ubuntu).
§8.11:
Normally, the real user ID is set by the
login(1)program when we log in and never changes. Becauseloginis a superuser process, it sets all three user IDs when it calls setuid
ps aux | grep login:
root 840 0.0 0.0 70732 6120 ? Ss 15:13 0:00 /lib/systemd/systemd-logind
root 1120 0.0 0.0 419680 9468 ? Sl 15:13 0:00 gdm-session-worker [pam/gdm-autologin]
tianhe 1151 0.0 0.1 445184 20540 ? SLl 15:13 0:05 /usr/bin/gnome-keyring-daemon --daemonize --login
tianhe 10838 0.0 0.0 21536 1060 pts/0 S+ 21:50 0:00 grep --color=auto login
So in short, what functionality does this login program provide for the OS?
Under what circumstances it is used or run?
Btw, how is login compared to ssh?
login command
I Googled it before asking but did not find any useful posts explaining the use of it :(.
– Rick
2 days ago
add a comment |
I am reading APUE and it keeps refering to the login program, but I still don't know what it is doing in my operating system (Ubuntu).
§8.11:
Normally, the real user ID is set by the
login(1)program when we log in and never changes. Becauseloginis a superuser process, it sets all three user IDs when it calls setuid
ps aux | grep login:
root 840 0.0 0.0 70732 6120 ? Ss 15:13 0:00 /lib/systemd/systemd-logind
root 1120 0.0 0.0 419680 9468 ? Sl 15:13 0:00 gdm-session-worker [pam/gdm-autologin]
tianhe 1151 0.0 0.1 445184 20540 ? SLl 15:13 0:05 /usr/bin/gnome-keyring-daemon --daemonize --login
tianhe 10838 0.0 0.0 21536 1060 pts/0 S+ 21:50 0:00 grep --color=auto login
So in short, what functionality does this login program provide for the OS?
Under what circumstances it is used or run?
Btw, how is login compared to ssh?
login command
I am reading APUE and it keeps refering to the login program, but I still don't know what it is doing in my operating system (Ubuntu).
§8.11:
Normally, the real user ID is set by the
login(1)program when we log in and never changes. Becauseloginis a superuser process, it sets all three user IDs when it calls setuid
ps aux | grep login:
root 840 0.0 0.0 70732 6120 ? Ss 15:13 0:00 /lib/systemd/systemd-logind
root 1120 0.0 0.0 419680 9468 ? Sl 15:13 0:00 gdm-session-worker [pam/gdm-autologin]
tianhe 1151 0.0 0.1 445184 20540 ? SLl 15:13 0:05 /usr/bin/gnome-keyring-daemon --daemonize --login
tianhe 10838 0.0 0.0 21536 1060 pts/0 S+ 21:50 0:00 grep --color=auto login
So in short, what functionality does this login program provide for the OS?
Under what circumstances it is used or run?
Btw, how is login compared to ssh?
login command
login command
edited 12 hours ago
Rick
asked 2 days ago
RickRick
24329
24329
I Googled it before asking but did not find any useful posts explaining the use of it :(.
– Rick
2 days ago
add a comment |
I Googled it before asking but did not find any useful posts explaining the use of it :(.
– Rick
2 days ago
I Googled it before asking but did not find any useful posts explaining the use of it :(.
– Rick
2 days ago
I Googled it before asking but did not find any useful posts explaining the use of it :(.
– Rick
2 days ago
add a comment |
2 Answers
2
active
oldest
votes
You probably login to a windowing session, in this case a display manager xdm, gdm, kdm … will log you in. However there are other ways to login. For example over a network we can use (as you have pointed out) ssh. If we login locally, but not into a windowing system, then we need a different login program. This is where login comes in.
Try pressing ctrlaltf1, login then have a look at what processes are running. What logged you in.
Thank you. Combining with the answer by @JdBP, I seems to understand. However,ctrl + alt + f1does not prompt anything ( I am using Ubuntu) :(
– Rick
11 hours ago
That's because thectrl + alt + f#switches betweenvt#, and yourgdmlogin manager is likely running onvt1, which is reached fromctrl + alt + f1. Tryctrl + alt + F2throughF8(sheesh, why doesn't <kbd>x</kbd> work in comments?)
– Rich
10 hours ago
1
@rich I don't understand your comments.
– ctrl-alt-delor
2 hours ago
@Rich Are you kidding me? My system crashed after I pressedctrl + alt + F2:(
– Rick
1 hour ago
add a comment |
It isn't a command for you to run interactively.
The login command is not normally entered on the command line.—
login manual. IBM AIX 7.2It used to be. Back in the 1980s, this would work, and C-shell users even had a convenience login built-in command which would exec the external login program, overlaying the shell process with that program, which was set-UID to the superuser.
But operating systems do not work nowadays like BSD of the 1980s. A login session (which is the type of session being discussed there, by the way) goes through too many one-way trapdoors (user security contexts, control groups, changed-UID "taint" markers, AIX setsenv, and so forth) for it to be feasible to correctly start a fresh login session for an arbitrary user from a process that is already in a user login session.
And in any case, because of the advent of PAM in the 1990s, the shell process that would be overlaid with the new login program is no longer the topmost process in the tree as it was in the 1980s. It's now a child of a supervisory process, that is doing PAM session setup and teardown.
This is why "dæmonization" is a fallacy and this is why running login from within an existing login session is not really sensible.
It is a system program.
login is invoked by terminal login services, usually directly, after the service or the service management infrastructure has set up some environment variables, opened the terminal device and initialized/pushed the line discipline, set it as the controlling terminal, and initialized the terminal with some control sequences.
- On AT&T Unix System 5 Release 4 back in 1987, these would be services managed by
ttymon, part of the Service Access Facility. You can still see these today on OpenSolaris and its derivatives such as Illumos and Schillix. - On systemd Linux operating systems these are the
autovt@somethingservices (usually aliases forgetty@somethingservices). This is the notable odd-one-out of the System 5 side of the universe, still using agettyprogram to invokeloginwhen almost no-one else does any more. - On operating systems using the nosh toolset for service management, these are the
ttylogin@somethingservices. - In the BSD side of the universe, if not using nosh service management, these are services spawned by process #1 according to the
/etc/ttystable.
If you logged in on a virtual terminal, or a real terminal, it was login that prompted you for your password, and possibly for your user name as well, and then proceeded to invoke your interactive login shell.
login is not used by SSH login. Nor is it used by GUI login. Both of these operate differently, using other programs. login expects to be talking to a terminal, with a Textual User Interface.
It is used by the old Berkeley rlogin system, but you should not be employing that nowadays. Further discussion of the so-called Berkeley "r-" commands is way beyond the scope of this answer. So I'll just say that this is something else that isn't done any more the way that it was in the 1980s.
Further reading
- Jonathan de Boyne Pollard. "Terminals". nosh Guide. Softwares.
- Jonathan de Boyne Pollard (2018).
gettyspawned frominitis a thing of the past.. Frequently Given Answers. - https://unix.stackexchange.com/a/446619/5132
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f506699%2fwhat-does-the-unix-login-program-command-do%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You probably login to a windowing session, in this case a display manager xdm, gdm, kdm … will log you in. However there are other ways to login. For example over a network we can use (as you have pointed out) ssh. If we login locally, but not into a windowing system, then we need a different login program. This is where login comes in.
Try pressing ctrlaltf1, login then have a look at what processes are running. What logged you in.
Thank you. Combining with the answer by @JdBP, I seems to understand. However,ctrl + alt + f1does not prompt anything ( I am using Ubuntu) :(
– Rick
11 hours ago
That's because thectrl + alt + f#switches betweenvt#, and yourgdmlogin manager is likely running onvt1, which is reached fromctrl + alt + f1. Tryctrl + alt + F2throughF8(sheesh, why doesn't <kbd>x</kbd> work in comments?)
– Rich
10 hours ago
1
@rich I don't understand your comments.
– ctrl-alt-delor
2 hours ago
@Rich Are you kidding me? My system crashed after I pressedctrl + alt + F2:(
– Rick
1 hour ago
add a comment |
You probably login to a windowing session, in this case a display manager xdm, gdm, kdm … will log you in. However there are other ways to login. For example over a network we can use (as you have pointed out) ssh. If we login locally, but not into a windowing system, then we need a different login program. This is where login comes in.
Try pressing ctrlaltf1, login then have a look at what processes are running. What logged you in.
Thank you. Combining with the answer by @JdBP, I seems to understand. However,ctrl + alt + f1does not prompt anything ( I am using Ubuntu) :(
– Rick
11 hours ago
That's because thectrl + alt + f#switches betweenvt#, and yourgdmlogin manager is likely running onvt1, which is reached fromctrl + alt + f1. Tryctrl + alt + F2throughF8(sheesh, why doesn't <kbd>x</kbd> work in comments?)
– Rich
10 hours ago
1
@rich I don't understand your comments.
– ctrl-alt-delor
2 hours ago
@Rich Are you kidding me? My system crashed after I pressedctrl + alt + F2:(
– Rick
1 hour ago
add a comment |
You probably login to a windowing session, in this case a display manager xdm, gdm, kdm … will log you in. However there are other ways to login. For example over a network we can use (as you have pointed out) ssh. If we login locally, but not into a windowing system, then we need a different login program. This is where login comes in.
Try pressing ctrlaltf1, login then have a look at what processes are running. What logged you in.
You probably login to a windowing session, in this case a display manager xdm, gdm, kdm … will log you in. However there are other ways to login. For example over a network we can use (as you have pointed out) ssh. If we login locally, but not into a windowing system, then we need a different login program. This is where login comes in.
Try pressing ctrlaltf1, login then have a look at what processes are running. What logged you in.
answered 2 days ago
ctrl-alt-delorctrl-alt-delor
12k42461
12k42461
Thank you. Combining with the answer by @JdBP, I seems to understand. However,ctrl + alt + f1does not prompt anything ( I am using Ubuntu) :(
– Rick
11 hours ago
That's because thectrl + alt + f#switches betweenvt#, and yourgdmlogin manager is likely running onvt1, which is reached fromctrl + alt + f1. Tryctrl + alt + F2throughF8(sheesh, why doesn't <kbd>x</kbd> work in comments?)
– Rich
10 hours ago
1
@rich I don't understand your comments.
– ctrl-alt-delor
2 hours ago
@Rich Are you kidding me? My system crashed after I pressedctrl + alt + F2:(
– Rick
1 hour ago
add a comment |
Thank you. Combining with the answer by @JdBP, I seems to understand. However,ctrl + alt + f1does not prompt anything ( I am using Ubuntu) :(
– Rick
11 hours ago
That's because thectrl + alt + f#switches betweenvt#, and yourgdmlogin manager is likely running onvt1, which is reached fromctrl + alt + f1. Tryctrl + alt + F2throughF8(sheesh, why doesn't <kbd>x</kbd> work in comments?)
– Rich
10 hours ago
1
@rich I don't understand your comments.
– ctrl-alt-delor
2 hours ago
@Rich Are you kidding me? My system crashed after I pressedctrl + alt + F2:(
– Rick
1 hour ago
Thank you. Combining with the answer by @JdBP, I seems to understand. However,
ctrl + alt + f1 does not prompt anything ( I am using Ubuntu) :(– Rick
11 hours ago
Thank you. Combining with the answer by @JdBP, I seems to understand. However,
ctrl + alt + f1 does not prompt anything ( I am using Ubuntu) :(– Rick
11 hours ago
That's because the
ctrl + alt + f# switches between vt#, and your gdm login manager is likely running on vt1, which is reached from ctrl + alt + f1. Try ctrl + alt + F2 through F8 (sheesh, why doesn't <kbd>x</kbd> work in comments?)– Rich
10 hours ago
That's because the
ctrl + alt + f# switches between vt#, and your gdm login manager is likely running on vt1, which is reached from ctrl + alt + f1. Try ctrl + alt + F2 through F8 (sheesh, why doesn't <kbd>x</kbd> work in comments?)– Rich
10 hours ago
1
1
@rich I don't understand your comments.
– ctrl-alt-delor
2 hours ago
@rich I don't understand your comments.
– ctrl-alt-delor
2 hours ago
@Rich Are you kidding me? My system crashed after I pressed
ctrl + alt + F2 :(– Rick
1 hour ago
@Rich Are you kidding me? My system crashed after I pressed
ctrl + alt + F2 :(– Rick
1 hour ago
add a comment |
It isn't a command for you to run interactively.
The login command is not normally entered on the command line.—
login manual. IBM AIX 7.2It used to be. Back in the 1980s, this would work, and C-shell users even had a convenience login built-in command which would exec the external login program, overlaying the shell process with that program, which was set-UID to the superuser.
But operating systems do not work nowadays like BSD of the 1980s. A login session (which is the type of session being discussed there, by the way) goes through too many one-way trapdoors (user security contexts, control groups, changed-UID "taint" markers, AIX setsenv, and so forth) for it to be feasible to correctly start a fresh login session for an arbitrary user from a process that is already in a user login session.
And in any case, because of the advent of PAM in the 1990s, the shell process that would be overlaid with the new login program is no longer the topmost process in the tree as it was in the 1980s. It's now a child of a supervisory process, that is doing PAM session setup and teardown.
This is why "dæmonization" is a fallacy and this is why running login from within an existing login session is not really sensible.
It is a system program.
login is invoked by terminal login services, usually directly, after the service or the service management infrastructure has set up some environment variables, opened the terminal device and initialized/pushed the line discipline, set it as the controlling terminal, and initialized the terminal with some control sequences.
- On AT&T Unix System 5 Release 4 back in 1987, these would be services managed by
ttymon, part of the Service Access Facility. You can still see these today on OpenSolaris and its derivatives such as Illumos and Schillix. - On systemd Linux operating systems these are the
autovt@somethingservices (usually aliases forgetty@somethingservices). This is the notable odd-one-out of the System 5 side of the universe, still using agettyprogram to invokeloginwhen almost no-one else does any more. - On operating systems using the nosh toolset for service management, these are the
ttylogin@somethingservices. - In the BSD side of the universe, if not using nosh service management, these are services spawned by process #1 according to the
/etc/ttystable.
If you logged in on a virtual terminal, or a real terminal, it was login that prompted you for your password, and possibly for your user name as well, and then proceeded to invoke your interactive login shell.
login is not used by SSH login. Nor is it used by GUI login. Both of these operate differently, using other programs. login expects to be talking to a terminal, with a Textual User Interface.
It is used by the old Berkeley rlogin system, but you should not be employing that nowadays. Further discussion of the so-called Berkeley "r-" commands is way beyond the scope of this answer. So I'll just say that this is something else that isn't done any more the way that it was in the 1980s.
Further reading
- Jonathan de Boyne Pollard. "Terminals". nosh Guide. Softwares.
- Jonathan de Boyne Pollard (2018).
gettyspawned frominitis a thing of the past.. Frequently Given Answers. - https://unix.stackexchange.com/a/446619/5132
add a comment |
It isn't a command for you to run interactively.
The login command is not normally entered on the command line.—
login manual. IBM AIX 7.2It used to be. Back in the 1980s, this would work, and C-shell users even had a convenience login built-in command which would exec the external login program, overlaying the shell process with that program, which was set-UID to the superuser.
But operating systems do not work nowadays like BSD of the 1980s. A login session (which is the type of session being discussed there, by the way) goes through too many one-way trapdoors (user security contexts, control groups, changed-UID "taint" markers, AIX setsenv, and so forth) for it to be feasible to correctly start a fresh login session for an arbitrary user from a process that is already in a user login session.
And in any case, because of the advent of PAM in the 1990s, the shell process that would be overlaid with the new login program is no longer the topmost process in the tree as it was in the 1980s. It's now a child of a supervisory process, that is doing PAM session setup and teardown.
This is why "dæmonization" is a fallacy and this is why running login from within an existing login session is not really sensible.
It is a system program.
login is invoked by terminal login services, usually directly, after the service or the service management infrastructure has set up some environment variables, opened the terminal device and initialized/pushed the line discipline, set it as the controlling terminal, and initialized the terminal with some control sequences.
- On AT&T Unix System 5 Release 4 back in 1987, these would be services managed by
ttymon, part of the Service Access Facility. You can still see these today on OpenSolaris and its derivatives such as Illumos and Schillix. - On systemd Linux operating systems these are the
autovt@somethingservices (usually aliases forgetty@somethingservices). This is the notable odd-one-out of the System 5 side of the universe, still using agettyprogram to invokeloginwhen almost no-one else does any more. - On operating systems using the nosh toolset for service management, these are the
ttylogin@somethingservices. - In the BSD side of the universe, if not using nosh service management, these are services spawned by process #1 according to the
/etc/ttystable.
If you logged in on a virtual terminal, or a real terminal, it was login that prompted you for your password, and possibly for your user name as well, and then proceeded to invoke your interactive login shell.
login is not used by SSH login. Nor is it used by GUI login. Both of these operate differently, using other programs. login expects to be talking to a terminal, with a Textual User Interface.
It is used by the old Berkeley rlogin system, but you should not be employing that nowadays. Further discussion of the so-called Berkeley "r-" commands is way beyond the scope of this answer. So I'll just say that this is something else that isn't done any more the way that it was in the 1980s.
Further reading
- Jonathan de Boyne Pollard. "Terminals". nosh Guide. Softwares.
- Jonathan de Boyne Pollard (2018).
gettyspawned frominitis a thing of the past.. Frequently Given Answers. - https://unix.stackexchange.com/a/446619/5132
add a comment |
It isn't a command for you to run interactively.
The login command is not normally entered on the command line.—
login manual. IBM AIX 7.2It used to be. Back in the 1980s, this would work, and C-shell users even had a convenience login built-in command which would exec the external login program, overlaying the shell process with that program, which was set-UID to the superuser.
But operating systems do not work nowadays like BSD of the 1980s. A login session (which is the type of session being discussed there, by the way) goes through too many one-way trapdoors (user security contexts, control groups, changed-UID "taint" markers, AIX setsenv, and so forth) for it to be feasible to correctly start a fresh login session for an arbitrary user from a process that is already in a user login session.
And in any case, because of the advent of PAM in the 1990s, the shell process that would be overlaid with the new login program is no longer the topmost process in the tree as it was in the 1980s. It's now a child of a supervisory process, that is doing PAM session setup and teardown.
This is why "dæmonization" is a fallacy and this is why running login from within an existing login session is not really sensible.
It is a system program.
login is invoked by terminal login services, usually directly, after the service or the service management infrastructure has set up some environment variables, opened the terminal device and initialized/pushed the line discipline, set it as the controlling terminal, and initialized the terminal with some control sequences.
- On AT&T Unix System 5 Release 4 back in 1987, these would be services managed by
ttymon, part of the Service Access Facility. You can still see these today on OpenSolaris and its derivatives such as Illumos and Schillix. - On systemd Linux operating systems these are the
autovt@somethingservices (usually aliases forgetty@somethingservices). This is the notable odd-one-out of the System 5 side of the universe, still using agettyprogram to invokeloginwhen almost no-one else does any more. - On operating systems using the nosh toolset for service management, these are the
ttylogin@somethingservices. - In the BSD side of the universe, if not using nosh service management, these are services spawned by process #1 according to the
/etc/ttystable.
If you logged in on a virtual terminal, or a real terminal, it was login that prompted you for your password, and possibly for your user name as well, and then proceeded to invoke your interactive login shell.
login is not used by SSH login. Nor is it used by GUI login. Both of these operate differently, using other programs. login expects to be talking to a terminal, with a Textual User Interface.
It is used by the old Berkeley rlogin system, but you should not be employing that nowadays. Further discussion of the so-called Berkeley "r-" commands is way beyond the scope of this answer. So I'll just say that this is something else that isn't done any more the way that it was in the 1980s.
Further reading
- Jonathan de Boyne Pollard. "Terminals". nosh Guide. Softwares.
- Jonathan de Boyne Pollard (2018).
gettyspawned frominitis a thing of the past.. Frequently Given Answers. - https://unix.stackexchange.com/a/446619/5132
It isn't a command for you to run interactively.
The login command is not normally entered on the command line.—
login manual. IBM AIX 7.2It used to be. Back in the 1980s, this would work, and C-shell users even had a convenience login built-in command which would exec the external login program, overlaying the shell process with that program, which was set-UID to the superuser.
But operating systems do not work nowadays like BSD of the 1980s. A login session (which is the type of session being discussed there, by the way) goes through too many one-way trapdoors (user security contexts, control groups, changed-UID "taint" markers, AIX setsenv, and so forth) for it to be feasible to correctly start a fresh login session for an arbitrary user from a process that is already in a user login session.
And in any case, because of the advent of PAM in the 1990s, the shell process that would be overlaid with the new login program is no longer the topmost process in the tree as it was in the 1980s. It's now a child of a supervisory process, that is doing PAM session setup and teardown.
This is why "dæmonization" is a fallacy and this is why running login from within an existing login session is not really sensible.
It is a system program.
login is invoked by terminal login services, usually directly, after the service or the service management infrastructure has set up some environment variables, opened the terminal device and initialized/pushed the line discipline, set it as the controlling terminal, and initialized the terminal with some control sequences.
- On AT&T Unix System 5 Release 4 back in 1987, these would be services managed by
ttymon, part of the Service Access Facility. You can still see these today on OpenSolaris and its derivatives such as Illumos and Schillix. - On systemd Linux operating systems these are the
autovt@somethingservices (usually aliases forgetty@somethingservices). This is the notable odd-one-out of the System 5 side of the universe, still using agettyprogram to invokeloginwhen almost no-one else does any more. - On operating systems using the nosh toolset for service management, these are the
ttylogin@somethingservices. - In the BSD side of the universe, if not using nosh service management, these are services spawned by process #1 according to the
/etc/ttystable.
If you logged in on a virtual terminal, or a real terminal, it was login that prompted you for your password, and possibly for your user name as well, and then proceeded to invoke your interactive login shell.
login is not used by SSH login. Nor is it used by GUI login. Both of these operate differently, using other programs. login expects to be talking to a terminal, with a Textual User Interface.
It is used by the old Berkeley rlogin system, but you should not be employing that nowadays. Further discussion of the so-called Berkeley "r-" commands is way beyond the scope of this answer. So I'll just say that this is something else that isn't done any more the way that it was in the 1980s.
Further reading
- Jonathan de Boyne Pollard. "Terminals". nosh Guide. Softwares.
- Jonathan de Boyne Pollard (2018).
gettyspawned frominitis a thing of the past.. Frequently Given Answers. - https://unix.stackexchange.com/a/446619/5132
answered 2 days ago
JdeBPJdeBP
37.2k476177
37.2k476177
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f506699%2fwhat-does-the-unix-login-program-command-do%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I Googled it before asking but did not find any useful posts explaining the use of it :(.
– Rick
2 days ago