Is it normal to have same user logged in twice but from another TTY?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
6
down vote

favorite
1












I don't know if this is something that is in macOS, but in Linux I normally see only one user if I run the who and w command.



Is it normal to have same user logged in twice but from another TTY?



I don't know where the second account with the same username came from.



jen-air:~ jen$ who
jen console Aug 22 20:56
jen ttys000 Aug 23 08:39

jen-air:~ jen$ w
8:43 up 11:47, 2 users, load averages: 1.51 1.60 1.70
USER TTY FROM LOGIN@ IDLE WHAT
jen console - Wed20 11:46 -
jen s000 - 8:39 - w






share|improve this question


























    up vote
    6
    down vote

    favorite
    1












    I don't know if this is something that is in macOS, but in Linux I normally see only one user if I run the who and w command.



    Is it normal to have same user logged in twice but from another TTY?



    I don't know where the second account with the same username came from.



    jen-air:~ jen$ who
    jen console Aug 22 20:56
    jen ttys000 Aug 23 08:39

    jen-air:~ jen$ w
    8:43 up 11:47, 2 users, load averages: 1.51 1.60 1.70
    USER TTY FROM LOGIN@ IDLE WHAT
    jen console - Wed20 11:46 -
    jen s000 - 8:39 - w






    share|improve this question
























      up vote
      6
      down vote

      favorite
      1









      up vote
      6
      down vote

      favorite
      1






      1





      I don't know if this is something that is in macOS, but in Linux I normally see only one user if I run the who and w command.



      Is it normal to have same user logged in twice but from another TTY?



      I don't know where the second account with the same username came from.



      jen-air:~ jen$ who
      jen console Aug 22 20:56
      jen ttys000 Aug 23 08:39

      jen-air:~ jen$ w
      8:43 up 11:47, 2 users, load averages: 1.51 1.60 1.70
      USER TTY FROM LOGIN@ IDLE WHAT
      jen console - Wed20 11:46 -
      jen s000 - 8:39 - w






      share|improve this question














      I don't know if this is something that is in macOS, but in Linux I normally see only one user if I run the who and w command.



      Is it normal to have same user logged in twice but from another TTY?



      I don't know where the second account with the same username came from.



      jen-air:~ jen$ who
      jen console Aug 22 20:56
      jen ttys000 Aug 23 08:39

      jen-air:~ jen$ w
      8:43 up 11:47, 2 users, load averages: 1.51 1.60 1.70
      USER TTY FROM LOGIN@ IDLE WHAT
      jen console - Wed20 11:46 -
      jen s000 - 8:39 - w








      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 28 at 4:28









      bmike♦

      149k45264583




      149k45264583










      asked Aug 23 at 7:01









      jennifer ruurs

      567




      567




















          4 Answers
          4






          active

          oldest

          votes

















          up vote
          7
          down vote



          accepted










          Here's a little more information about what is happening, from a lower level Unix perspective. It's long and goes beyond what you asked, but might be interesting to you or someone else passing this page.



          If you look at the w command's manual (man w), it says that "The w utility prints a summary of the current activity on the system, including what each user is doing." That's a little vague, and a little misleading. Specifically what w does is to tell you about current logins. Logins are recorded in a file named /var/run/utmpx. There are common library methods for updating utmpx entries, so that every program that needs to record or remove a login uses the same procedure.



          w reads the utmpx file using those common library routines and displays information about current login sessions, along with the foreground process. A login session can be doing many things at once, but only one program is in the foreground. All others are background, which is what happens when you put an & on your command or press control-Z while a program runs in a terminal.



          A login session is created when you log in to your computer on the built-in display. If you have user switching enabled, a login is recorded for each user, and remains active until logout. And if you remote login (e.g. with ssh), a login is recorded for that. Each of these should appear in w's output.



          Most terminal applications, including Terminal.app and iTerm, as well as xterm if you're using X11.app, are able to create login shells in a window or tab. When you create a new window in one of these applications, you can get another login session, which appears as another line in w. But these applications don't necessarily create login shells! Whether a new window/tab is a login shell is usually controlled in the preferences. For example, in iTerm2, you can choose in Preferences > Profiles > General > Command whether to launch a login shell or some other program. If you just put "bash" there, you'll get a shell, but it won't be a login shell.



          So what's the difference? It's subtle, but useful to know about.



          There's a good discussion of login shells vs. regular shells here: https://unix.stackexchange.com/questions/38175/difference-between-login-shell-and-non-login-shell. But we can summarize as: a login shell is started as the first process after something sets up a login in utmpx. A non-login shell can be run any time by any program, but is not the first process after an entry in utmpx. (More technically, a login shell is the lead process in a process group. The fact that it usually has a utmpx entry is descriptive, not necessary.)



          If your shell is bash, as most are, every instance of it reads and runs the .bashrc file. When bash runs as a login shell, it also reads and runs the .bash_profile and .profile files. Those files can contain instructions that should happen only for all new sessions. That's the main practical thing to know about login shells. That, and login shells appear in w.



          Here's an experiment to illustrate. Open a new Terminal window, and run w. You should see something like:



          11:57 up 7 days, 59 mins, 5 users, load averages: 3.58 3.53 3.91
          USER TTY FROM LOGIN@ IDLE WHAT
          dgc console - 16Aug18 7days -
          dgc s000 - 11:57 - w


          s000 is the name of the terminal that you're running w in. It exists on the filesystem at /dev/ttys000. Usually there's a one to one relation between login shells and terminals, but not always.



          Now open a new Terminal window. Switch back to the first one, and run w again.



          12:09 up 7 days, 1:11, 5 users, load averages: 5.35 4.35 4.05
          USER TTY FROM LOGIN@ IDLE WHAT
          dgc console - 16Aug18 7days -
          dgc s000 - 11:38 - w
          dgc s001 - 11:57 - -bash


          You see a new login on s001 — /dev/ttys001 — that's running -bash. That hyphen at the beginning is a convention telling you that bash is running as a login shell. There's no foreground program in that terminal, so w shows you the shell itself.



          Now switch back to your second window and run bash. What do you expect to happen?



          12:13 up 7 days, 1:14, 5 users, load averages: 5.61 5.07 4.41
          USER TTY FROM LOGIN@ IDLE WHAT
          dgc console - 16Aug18 7days -
          dgc s000 - 11:38 - w
          dgc s001 - 11:57 - bash


          The hyphen is gone. That's because the same login session (terminal) is now running, in the foreground, a shell that isn't a login shell. It's a child of the original -bash. If you flip back and type exit to quit the child bash, you'll see the -bash again.



          Finally, note the console login. That one will never change in ordinary use. It's running the desktop/window system usually. If you turn on your Mac and don't log in, but then you ssh in from another computer, you won't see that line at all. It will always appear idle, and will always appear to be running nothing — except with the hyphen, because it's a login session.



          When a program that created a login session ends that login, it goes back and removes the entry from utmpx using the common library methods for it. And because utmpx resides in the /var/run directory, it gets automatically removed whenever your computer reboots — so if you suddenly powered off your Mac while logged in, you don't continue to see fake logins forever.






          share|improve this answer





























            up vote
            11
            down vote













            The default Terminal app in macOS opens up a second login so when who or w command is executed the Terminal app, there's a second login.



            Depending on your environment and the Terminal app, some terminal emulation apps like iTerm2 will show only one login.






            share|improve this answer





























              up vote
              9
              down vote













              Yes it is normal.



              Console is your desktop login and the second login appears after you open a Terminal window. In-fact if you have more than one Terminal window/tab open, an entry is shown corresponding to each.






              share|improve this answer






















              • It's a little surprising that there's no setting in Preferences to control whether the window is a login or not.
                – Barmar
                Aug 23 at 19:18

















              up vote
              0
              down vote













              Yes it's normal. If you use a terminal multiplexer like tmux or screen, each 'tab' will be a separate user session.






              share|improve this answer




















                Your Answer







                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "118"
                ;
                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',
                convertImagesToLinks: false,
                noModals: false,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );













                 

                draft saved


                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f334487%2fis-it-normal-to-have-same-user-logged-in-twice-but-from-another-tty%23new-answer', 'question_page');

                );

                Post as a guest






























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                7
                down vote



                accepted










                Here's a little more information about what is happening, from a lower level Unix perspective. It's long and goes beyond what you asked, but might be interesting to you or someone else passing this page.



                If you look at the w command's manual (man w), it says that "The w utility prints a summary of the current activity on the system, including what each user is doing." That's a little vague, and a little misleading. Specifically what w does is to tell you about current logins. Logins are recorded in a file named /var/run/utmpx. There are common library methods for updating utmpx entries, so that every program that needs to record or remove a login uses the same procedure.



                w reads the utmpx file using those common library routines and displays information about current login sessions, along with the foreground process. A login session can be doing many things at once, but only one program is in the foreground. All others are background, which is what happens when you put an & on your command or press control-Z while a program runs in a terminal.



                A login session is created when you log in to your computer on the built-in display. If you have user switching enabled, a login is recorded for each user, and remains active until logout. And if you remote login (e.g. with ssh), a login is recorded for that. Each of these should appear in w's output.



                Most terminal applications, including Terminal.app and iTerm, as well as xterm if you're using X11.app, are able to create login shells in a window or tab. When you create a new window in one of these applications, you can get another login session, which appears as another line in w. But these applications don't necessarily create login shells! Whether a new window/tab is a login shell is usually controlled in the preferences. For example, in iTerm2, you can choose in Preferences > Profiles > General > Command whether to launch a login shell or some other program. If you just put "bash" there, you'll get a shell, but it won't be a login shell.



                So what's the difference? It's subtle, but useful to know about.



                There's a good discussion of login shells vs. regular shells here: https://unix.stackexchange.com/questions/38175/difference-between-login-shell-and-non-login-shell. But we can summarize as: a login shell is started as the first process after something sets up a login in utmpx. A non-login shell can be run any time by any program, but is not the first process after an entry in utmpx. (More technically, a login shell is the lead process in a process group. The fact that it usually has a utmpx entry is descriptive, not necessary.)



                If your shell is bash, as most are, every instance of it reads and runs the .bashrc file. When bash runs as a login shell, it also reads and runs the .bash_profile and .profile files. Those files can contain instructions that should happen only for all new sessions. That's the main practical thing to know about login shells. That, and login shells appear in w.



                Here's an experiment to illustrate. Open a new Terminal window, and run w. You should see something like:



                11:57 up 7 days, 59 mins, 5 users, load averages: 3.58 3.53 3.91
                USER TTY FROM LOGIN@ IDLE WHAT
                dgc console - 16Aug18 7days -
                dgc s000 - 11:57 - w


                s000 is the name of the terminal that you're running w in. It exists on the filesystem at /dev/ttys000. Usually there's a one to one relation between login shells and terminals, but not always.



                Now open a new Terminal window. Switch back to the first one, and run w again.



                12:09 up 7 days, 1:11, 5 users, load averages: 5.35 4.35 4.05
                USER TTY FROM LOGIN@ IDLE WHAT
                dgc console - 16Aug18 7days -
                dgc s000 - 11:38 - w
                dgc s001 - 11:57 - -bash


                You see a new login on s001 — /dev/ttys001 — that's running -bash. That hyphen at the beginning is a convention telling you that bash is running as a login shell. There's no foreground program in that terminal, so w shows you the shell itself.



                Now switch back to your second window and run bash. What do you expect to happen?



                12:13 up 7 days, 1:14, 5 users, load averages: 5.61 5.07 4.41
                USER TTY FROM LOGIN@ IDLE WHAT
                dgc console - 16Aug18 7days -
                dgc s000 - 11:38 - w
                dgc s001 - 11:57 - bash


                The hyphen is gone. That's because the same login session (terminal) is now running, in the foreground, a shell that isn't a login shell. It's a child of the original -bash. If you flip back and type exit to quit the child bash, you'll see the -bash again.



                Finally, note the console login. That one will never change in ordinary use. It's running the desktop/window system usually. If you turn on your Mac and don't log in, but then you ssh in from another computer, you won't see that line at all. It will always appear idle, and will always appear to be running nothing — except with the hyphen, because it's a login session.



                When a program that created a login session ends that login, it goes back and removes the entry from utmpx using the common library methods for it. And because utmpx resides in the /var/run directory, it gets automatically removed whenever your computer reboots — so if you suddenly powered off your Mac while logged in, you don't continue to see fake logins forever.






                share|improve this answer


























                  up vote
                  7
                  down vote



                  accepted










                  Here's a little more information about what is happening, from a lower level Unix perspective. It's long and goes beyond what you asked, but might be interesting to you or someone else passing this page.



                  If you look at the w command's manual (man w), it says that "The w utility prints a summary of the current activity on the system, including what each user is doing." That's a little vague, and a little misleading. Specifically what w does is to tell you about current logins. Logins are recorded in a file named /var/run/utmpx. There are common library methods for updating utmpx entries, so that every program that needs to record or remove a login uses the same procedure.



                  w reads the utmpx file using those common library routines and displays information about current login sessions, along with the foreground process. A login session can be doing many things at once, but only one program is in the foreground. All others are background, which is what happens when you put an & on your command or press control-Z while a program runs in a terminal.



                  A login session is created when you log in to your computer on the built-in display. If you have user switching enabled, a login is recorded for each user, and remains active until logout. And if you remote login (e.g. with ssh), a login is recorded for that. Each of these should appear in w's output.



                  Most terminal applications, including Terminal.app and iTerm, as well as xterm if you're using X11.app, are able to create login shells in a window or tab. When you create a new window in one of these applications, you can get another login session, which appears as another line in w. But these applications don't necessarily create login shells! Whether a new window/tab is a login shell is usually controlled in the preferences. For example, in iTerm2, you can choose in Preferences > Profiles > General > Command whether to launch a login shell or some other program. If you just put "bash" there, you'll get a shell, but it won't be a login shell.



                  So what's the difference? It's subtle, but useful to know about.



                  There's a good discussion of login shells vs. regular shells here: https://unix.stackexchange.com/questions/38175/difference-between-login-shell-and-non-login-shell. But we can summarize as: a login shell is started as the first process after something sets up a login in utmpx. A non-login shell can be run any time by any program, but is not the first process after an entry in utmpx. (More technically, a login shell is the lead process in a process group. The fact that it usually has a utmpx entry is descriptive, not necessary.)



                  If your shell is bash, as most are, every instance of it reads and runs the .bashrc file. When bash runs as a login shell, it also reads and runs the .bash_profile and .profile files. Those files can contain instructions that should happen only for all new sessions. That's the main practical thing to know about login shells. That, and login shells appear in w.



                  Here's an experiment to illustrate. Open a new Terminal window, and run w. You should see something like:



                  11:57 up 7 days, 59 mins, 5 users, load averages: 3.58 3.53 3.91
                  USER TTY FROM LOGIN@ IDLE WHAT
                  dgc console - 16Aug18 7days -
                  dgc s000 - 11:57 - w


                  s000 is the name of the terminal that you're running w in. It exists on the filesystem at /dev/ttys000. Usually there's a one to one relation between login shells and terminals, but not always.



                  Now open a new Terminal window. Switch back to the first one, and run w again.



                  12:09 up 7 days, 1:11, 5 users, load averages: 5.35 4.35 4.05
                  USER TTY FROM LOGIN@ IDLE WHAT
                  dgc console - 16Aug18 7days -
                  dgc s000 - 11:38 - w
                  dgc s001 - 11:57 - -bash


                  You see a new login on s001 — /dev/ttys001 — that's running -bash. That hyphen at the beginning is a convention telling you that bash is running as a login shell. There's no foreground program in that terminal, so w shows you the shell itself.



                  Now switch back to your second window and run bash. What do you expect to happen?



                  12:13 up 7 days, 1:14, 5 users, load averages: 5.61 5.07 4.41
                  USER TTY FROM LOGIN@ IDLE WHAT
                  dgc console - 16Aug18 7days -
                  dgc s000 - 11:38 - w
                  dgc s001 - 11:57 - bash


                  The hyphen is gone. That's because the same login session (terminal) is now running, in the foreground, a shell that isn't a login shell. It's a child of the original -bash. If you flip back and type exit to quit the child bash, you'll see the -bash again.



                  Finally, note the console login. That one will never change in ordinary use. It's running the desktop/window system usually. If you turn on your Mac and don't log in, but then you ssh in from another computer, you won't see that line at all. It will always appear idle, and will always appear to be running nothing — except with the hyphen, because it's a login session.



                  When a program that created a login session ends that login, it goes back and removes the entry from utmpx using the common library methods for it. And because utmpx resides in the /var/run directory, it gets automatically removed whenever your computer reboots — so if you suddenly powered off your Mac while logged in, you don't continue to see fake logins forever.






                  share|improve this answer
























                    up vote
                    7
                    down vote



                    accepted







                    up vote
                    7
                    down vote



                    accepted






                    Here's a little more information about what is happening, from a lower level Unix perspective. It's long and goes beyond what you asked, but might be interesting to you or someone else passing this page.



                    If you look at the w command's manual (man w), it says that "The w utility prints a summary of the current activity on the system, including what each user is doing." That's a little vague, and a little misleading. Specifically what w does is to tell you about current logins. Logins are recorded in a file named /var/run/utmpx. There are common library methods for updating utmpx entries, so that every program that needs to record or remove a login uses the same procedure.



                    w reads the utmpx file using those common library routines and displays information about current login sessions, along with the foreground process. A login session can be doing many things at once, but only one program is in the foreground. All others are background, which is what happens when you put an & on your command or press control-Z while a program runs in a terminal.



                    A login session is created when you log in to your computer on the built-in display. If you have user switching enabled, a login is recorded for each user, and remains active until logout. And if you remote login (e.g. with ssh), a login is recorded for that. Each of these should appear in w's output.



                    Most terminal applications, including Terminal.app and iTerm, as well as xterm if you're using X11.app, are able to create login shells in a window or tab. When you create a new window in one of these applications, you can get another login session, which appears as another line in w. But these applications don't necessarily create login shells! Whether a new window/tab is a login shell is usually controlled in the preferences. For example, in iTerm2, you can choose in Preferences > Profiles > General > Command whether to launch a login shell or some other program. If you just put "bash" there, you'll get a shell, but it won't be a login shell.



                    So what's the difference? It's subtle, but useful to know about.



                    There's a good discussion of login shells vs. regular shells here: https://unix.stackexchange.com/questions/38175/difference-between-login-shell-and-non-login-shell. But we can summarize as: a login shell is started as the first process after something sets up a login in utmpx. A non-login shell can be run any time by any program, but is not the first process after an entry in utmpx. (More technically, a login shell is the lead process in a process group. The fact that it usually has a utmpx entry is descriptive, not necessary.)



                    If your shell is bash, as most are, every instance of it reads and runs the .bashrc file. When bash runs as a login shell, it also reads and runs the .bash_profile and .profile files. Those files can contain instructions that should happen only for all new sessions. That's the main practical thing to know about login shells. That, and login shells appear in w.



                    Here's an experiment to illustrate. Open a new Terminal window, and run w. You should see something like:



                    11:57 up 7 days, 59 mins, 5 users, load averages: 3.58 3.53 3.91
                    USER TTY FROM LOGIN@ IDLE WHAT
                    dgc console - 16Aug18 7days -
                    dgc s000 - 11:57 - w


                    s000 is the name of the terminal that you're running w in. It exists on the filesystem at /dev/ttys000. Usually there's a one to one relation between login shells and terminals, but not always.



                    Now open a new Terminal window. Switch back to the first one, and run w again.



                    12:09 up 7 days, 1:11, 5 users, load averages: 5.35 4.35 4.05
                    USER TTY FROM LOGIN@ IDLE WHAT
                    dgc console - 16Aug18 7days -
                    dgc s000 - 11:38 - w
                    dgc s001 - 11:57 - -bash


                    You see a new login on s001 — /dev/ttys001 — that's running -bash. That hyphen at the beginning is a convention telling you that bash is running as a login shell. There's no foreground program in that terminal, so w shows you the shell itself.



                    Now switch back to your second window and run bash. What do you expect to happen?



                    12:13 up 7 days, 1:14, 5 users, load averages: 5.61 5.07 4.41
                    USER TTY FROM LOGIN@ IDLE WHAT
                    dgc console - 16Aug18 7days -
                    dgc s000 - 11:38 - w
                    dgc s001 - 11:57 - bash


                    The hyphen is gone. That's because the same login session (terminal) is now running, in the foreground, a shell that isn't a login shell. It's a child of the original -bash. If you flip back and type exit to quit the child bash, you'll see the -bash again.



                    Finally, note the console login. That one will never change in ordinary use. It's running the desktop/window system usually. If you turn on your Mac and don't log in, but then you ssh in from another computer, you won't see that line at all. It will always appear idle, and will always appear to be running nothing — except with the hyphen, because it's a login session.



                    When a program that created a login session ends that login, it goes back and removes the entry from utmpx using the common library methods for it. And because utmpx resides in the /var/run directory, it gets automatically removed whenever your computer reboots — so if you suddenly powered off your Mac while logged in, you don't continue to see fake logins forever.






                    share|improve this answer














                    Here's a little more information about what is happening, from a lower level Unix perspective. It's long and goes beyond what you asked, but might be interesting to you or someone else passing this page.



                    If you look at the w command's manual (man w), it says that "The w utility prints a summary of the current activity on the system, including what each user is doing." That's a little vague, and a little misleading. Specifically what w does is to tell you about current logins. Logins are recorded in a file named /var/run/utmpx. There are common library methods for updating utmpx entries, so that every program that needs to record or remove a login uses the same procedure.



                    w reads the utmpx file using those common library routines and displays information about current login sessions, along with the foreground process. A login session can be doing many things at once, but only one program is in the foreground. All others are background, which is what happens when you put an & on your command or press control-Z while a program runs in a terminal.



                    A login session is created when you log in to your computer on the built-in display. If you have user switching enabled, a login is recorded for each user, and remains active until logout. And if you remote login (e.g. with ssh), a login is recorded for that. Each of these should appear in w's output.



                    Most terminal applications, including Terminal.app and iTerm, as well as xterm if you're using X11.app, are able to create login shells in a window or tab. When you create a new window in one of these applications, you can get another login session, which appears as another line in w. But these applications don't necessarily create login shells! Whether a new window/tab is a login shell is usually controlled in the preferences. For example, in iTerm2, you can choose in Preferences > Profiles > General > Command whether to launch a login shell or some other program. If you just put "bash" there, you'll get a shell, but it won't be a login shell.



                    So what's the difference? It's subtle, but useful to know about.



                    There's a good discussion of login shells vs. regular shells here: https://unix.stackexchange.com/questions/38175/difference-between-login-shell-and-non-login-shell. But we can summarize as: a login shell is started as the first process after something sets up a login in utmpx. A non-login shell can be run any time by any program, but is not the first process after an entry in utmpx. (More technically, a login shell is the lead process in a process group. The fact that it usually has a utmpx entry is descriptive, not necessary.)



                    If your shell is bash, as most are, every instance of it reads and runs the .bashrc file. When bash runs as a login shell, it also reads and runs the .bash_profile and .profile files. Those files can contain instructions that should happen only for all new sessions. That's the main practical thing to know about login shells. That, and login shells appear in w.



                    Here's an experiment to illustrate. Open a new Terminal window, and run w. You should see something like:



                    11:57 up 7 days, 59 mins, 5 users, load averages: 3.58 3.53 3.91
                    USER TTY FROM LOGIN@ IDLE WHAT
                    dgc console - 16Aug18 7days -
                    dgc s000 - 11:57 - w


                    s000 is the name of the terminal that you're running w in. It exists on the filesystem at /dev/ttys000. Usually there's a one to one relation between login shells and terminals, but not always.



                    Now open a new Terminal window. Switch back to the first one, and run w again.



                    12:09 up 7 days, 1:11, 5 users, load averages: 5.35 4.35 4.05
                    USER TTY FROM LOGIN@ IDLE WHAT
                    dgc console - 16Aug18 7days -
                    dgc s000 - 11:38 - w
                    dgc s001 - 11:57 - -bash


                    You see a new login on s001 — /dev/ttys001 — that's running -bash. That hyphen at the beginning is a convention telling you that bash is running as a login shell. There's no foreground program in that terminal, so w shows you the shell itself.



                    Now switch back to your second window and run bash. What do you expect to happen?



                    12:13 up 7 days, 1:14, 5 users, load averages: 5.61 5.07 4.41
                    USER TTY FROM LOGIN@ IDLE WHAT
                    dgc console - 16Aug18 7days -
                    dgc s000 - 11:38 - w
                    dgc s001 - 11:57 - bash


                    The hyphen is gone. That's because the same login session (terminal) is now running, in the foreground, a shell that isn't a login shell. It's a child of the original -bash. If you flip back and type exit to quit the child bash, you'll see the -bash again.



                    Finally, note the console login. That one will never change in ordinary use. It's running the desktop/window system usually. If you turn on your Mac and don't log in, but then you ssh in from another computer, you won't see that line at all. It will always appear idle, and will always appear to be running nothing — except with the hyphen, because it's a login session.



                    When a program that created a login session ends that login, it goes back and removes the entry from utmpx using the common library methods for it. And because utmpx resides in the /var/run directory, it gets automatically removed whenever your computer reboots — so if you suddenly powered off your Mac while logged in, you don't continue to see fake logins forever.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Aug 28 at 4:17

























                    answered Aug 23 at 19:24









                    dgc

                    863




                    863






















                        up vote
                        11
                        down vote













                        The default Terminal app in macOS opens up a second login so when who or w command is executed the Terminal app, there's a second login.



                        Depending on your environment and the Terminal app, some terminal emulation apps like iTerm2 will show only one login.






                        share|improve this answer


























                          up vote
                          11
                          down vote













                          The default Terminal app in macOS opens up a second login so when who or w command is executed the Terminal app, there's a second login.



                          Depending on your environment and the Terminal app, some terminal emulation apps like iTerm2 will show only one login.






                          share|improve this answer
























                            up vote
                            11
                            down vote










                            up vote
                            11
                            down vote









                            The default Terminal app in macOS opens up a second login so when who or w command is executed the Terminal app, there's a second login.



                            Depending on your environment and the Terminal app, some terminal emulation apps like iTerm2 will show only one login.






                            share|improve this answer














                            The default Terminal app in macOS opens up a second login so when who or w command is executed the Terminal app, there's a second login.



                            Depending on your environment and the Terminal app, some terminal emulation apps like iTerm2 will show only one login.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Aug 23 at 7:22









                            Nimesh Neema

                            7,51831242




                            7,51831242










                            answered Aug 23 at 7:17









                            Kysh

                            1113




                            1113




















                                up vote
                                9
                                down vote













                                Yes it is normal.



                                Console is your desktop login and the second login appears after you open a Terminal window. In-fact if you have more than one Terminal window/tab open, an entry is shown corresponding to each.






                                share|improve this answer






















                                • It's a little surprising that there's no setting in Preferences to control whether the window is a login or not.
                                  – Barmar
                                  Aug 23 at 19:18














                                up vote
                                9
                                down vote













                                Yes it is normal.



                                Console is your desktop login and the second login appears after you open a Terminal window. In-fact if you have more than one Terminal window/tab open, an entry is shown corresponding to each.






                                share|improve this answer






















                                • It's a little surprising that there's no setting in Preferences to control whether the window is a login or not.
                                  – Barmar
                                  Aug 23 at 19:18












                                up vote
                                9
                                down vote










                                up vote
                                9
                                down vote









                                Yes it is normal.



                                Console is your desktop login and the second login appears after you open a Terminal window. In-fact if you have more than one Terminal window/tab open, an entry is shown corresponding to each.






                                share|improve this answer














                                Yes it is normal.



                                Console is your desktop login and the second login appears after you open a Terminal window. In-fact if you have more than one Terminal window/tab open, an entry is shown corresponding to each.







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Aug 23 at 7:21









                                Nimesh Neema

                                7,51831242




                                7,51831242










                                answered Aug 23 at 7:04









                                dereli

                                2113




                                2113











                                • It's a little surprising that there's no setting in Preferences to control whether the window is a login or not.
                                  – Barmar
                                  Aug 23 at 19:18
















                                • It's a little surprising that there's no setting in Preferences to control whether the window is a login or not.
                                  – Barmar
                                  Aug 23 at 19:18















                                It's a little surprising that there's no setting in Preferences to control whether the window is a login or not.
                                – Barmar
                                Aug 23 at 19:18




                                It's a little surprising that there's no setting in Preferences to control whether the window is a login or not.
                                – Barmar
                                Aug 23 at 19:18










                                up vote
                                0
                                down vote













                                Yes it's normal. If you use a terminal multiplexer like tmux or screen, each 'tab' will be a separate user session.






                                share|improve this answer
























                                  up vote
                                  0
                                  down vote













                                  Yes it's normal. If you use a terminal multiplexer like tmux or screen, each 'tab' will be a separate user session.






                                  share|improve this answer






















                                    up vote
                                    0
                                    down vote










                                    up vote
                                    0
                                    down vote









                                    Yes it's normal. If you use a terminal multiplexer like tmux or screen, each 'tab' will be a separate user session.






                                    share|improve this answer












                                    Yes it's normal. If you use a terminal multiplexer like tmux or screen, each 'tab' will be a separate user session.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Aug 23 at 15:08









                                    rherthwe

                                    1




                                    1



























                                         

                                        draft saved


                                        draft discarded















































                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f334487%2fis-it-normal-to-have-same-user-logged-in-twice-but-from-another-tty%23new-answer', 'question_page');

                                        );

                                        Post as a guest













































































                                        Comments

                                        Popular posts from this blog

                                        Long meetings (6-7 hours a day): Being “babysat” by supervisor

                                        Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                                        Confectionery