w command doesn't show all pseudo-terminal sessions

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











up vote
0
down vote

favorite
2












If I open terminal and execute w command then it will show:



user tty7 :0 12:04 39:56 36.87s 0.06s /sbin/upstart -


Now if open terminator or xterm and execute w command then it will show it's entry in the output of w command like



user tty7 :0 12:04 39:56 36.87s 0.06s 
/sbin/upstart -
user pts/2 :0.0 12:50 1.00s 0.02s 0.00s w


but it will not show a new entry when I open gnome-terminal or xfce4-terminal.
Why it is showing new session for terminator and not for xfce4-terminal?







share|improve this question





















  • Are those terminals running your shell as an interactive login shell or just like an interactive shell (see if $- contains an l in the shell).
    – Kusalananda
    May 4 at 7:28










  • what is $- . I am getting error himBH command not found and for echo $- it says himBH
    – Debian_yadav
    May 4 at 7:51











  • Related: unix.stackexchange.com/questions/92784/…
    – Kusalananda
    May 4 at 8:13










  • I read it earlier but didn't get it.
    – Debian_yadav
    May 4 at 8:16






  • 1




    Interesting question that attracted two excellent answers. I've edited the title so that others may find this more easily.
    – Anthony Geoghegan
    Jul 6 at 10:17














up vote
0
down vote

favorite
2












If I open terminal and execute w command then it will show:



user tty7 :0 12:04 39:56 36.87s 0.06s /sbin/upstart -


Now if open terminator or xterm and execute w command then it will show it's entry in the output of w command like



user tty7 :0 12:04 39:56 36.87s 0.06s 
/sbin/upstart -
user pts/2 :0.0 12:50 1.00s 0.02s 0.00s w


but it will not show a new entry when I open gnome-terminal or xfce4-terminal.
Why it is showing new session for terminator and not for xfce4-terminal?







share|improve this question





















  • Are those terminals running your shell as an interactive login shell or just like an interactive shell (see if $- contains an l in the shell).
    – Kusalananda
    May 4 at 7:28










  • what is $- . I am getting error himBH command not found and for echo $- it says himBH
    – Debian_yadav
    May 4 at 7:51











  • Related: unix.stackexchange.com/questions/92784/…
    – Kusalananda
    May 4 at 8:13










  • I read it earlier but didn't get it.
    – Debian_yadav
    May 4 at 8:16






  • 1




    Interesting question that attracted two excellent answers. I've edited the title so that others may find this more easily.
    – Anthony Geoghegan
    Jul 6 at 10:17












up vote
0
down vote

favorite
2









up vote
0
down vote

favorite
2






2





If I open terminal and execute w command then it will show:



user tty7 :0 12:04 39:56 36.87s 0.06s /sbin/upstart -


Now if open terminator or xterm and execute w command then it will show it's entry in the output of w command like



user tty7 :0 12:04 39:56 36.87s 0.06s 
/sbin/upstart -
user pts/2 :0.0 12:50 1.00s 0.02s 0.00s w


but it will not show a new entry when I open gnome-terminal or xfce4-terminal.
Why it is showing new session for terminator and not for xfce4-terminal?







share|improve this question













If I open terminal and execute w command then it will show:



user tty7 :0 12:04 39:56 36.87s 0.06s /sbin/upstart -


Now if open terminator or xterm and execute w command then it will show it's entry in the output of w command like



user tty7 :0 12:04 39:56 36.87s 0.06s 
/sbin/upstart -
user pts/2 :0.0 12:50 1.00s 0.02s 0.00s w


but it will not show a new entry when I open gnome-terminal or xfce4-terminal.
Why it is showing new session for terminator and not for xfce4-terminal?









share|improve this question












share|improve this question




share|improve this question








edited Jul 6 at 10:15









Anthony Geoghegan

7,16633651




7,16633651









asked May 4 at 7:25









Debian_yadav

8342522




8342522











  • Are those terminals running your shell as an interactive login shell or just like an interactive shell (see if $- contains an l in the shell).
    – Kusalananda
    May 4 at 7:28










  • what is $- . I am getting error himBH command not found and for echo $- it says himBH
    – Debian_yadav
    May 4 at 7:51











  • Related: unix.stackexchange.com/questions/92784/…
    – Kusalananda
    May 4 at 8:13










  • I read it earlier but didn't get it.
    – Debian_yadav
    May 4 at 8:16






  • 1




    Interesting question that attracted two excellent answers. I've edited the title so that others may find this more easily.
    – Anthony Geoghegan
    Jul 6 at 10:17
















  • Are those terminals running your shell as an interactive login shell or just like an interactive shell (see if $- contains an l in the shell).
    – Kusalananda
    May 4 at 7:28










  • what is $- . I am getting error himBH command not found and for echo $- it says himBH
    – Debian_yadav
    May 4 at 7:51











  • Related: unix.stackexchange.com/questions/92784/…
    – Kusalananda
    May 4 at 8:13










  • I read it earlier but didn't get it.
    – Debian_yadav
    May 4 at 8:16






  • 1




    Interesting question that attracted two excellent answers. I've edited the title so that others may find this more easily.
    – Anthony Geoghegan
    Jul 6 at 10:17















Are those terminals running your shell as an interactive login shell or just like an interactive shell (see if $- contains an l in the shell).
– Kusalananda
May 4 at 7:28




Are those terminals running your shell as an interactive login shell or just like an interactive shell (see if $- contains an l in the shell).
– Kusalananda
May 4 at 7:28












what is $- . I am getting error himBH command not found and for echo $- it says himBH
– Debian_yadav
May 4 at 7:51





what is $- . I am getting error himBH command not found and for echo $- it says himBH
– Debian_yadav
May 4 at 7:51













Related: unix.stackexchange.com/questions/92784/…
– Kusalananda
May 4 at 8:13




Related: unix.stackexchange.com/questions/92784/…
– Kusalananda
May 4 at 8:13












I read it earlier but didn't get it.
– Debian_yadav
May 4 at 8:16




I read it earlier but didn't get it.
– Debian_yadav
May 4 at 8:16




1




1




Interesting question that attracted two excellent answers. I've edited the title so that others may find this more easily.
– Anthony Geoghegan
Jul 6 at 10:17




Interesting question that attracted two excellent answers. I've edited the title so that others may find this more easily.
– Anthony Geoghegan
Jul 6 at 10:17










2 Answers
2






active

oldest

votes

















up vote
4
down vote



accepted










w displays the information stored in utmp (/var/run/utmp typically on Linux systems). This generally is only updated by “login” sessions, i.e. login (for logins on virtual consoles or serial connections), the display manager (for graphical sessions), the SSH server (for SSH connections), and some (most?) terminal emulators. In the latter case, whether or not they update utmp depends on their built-in support and configuration; for example xterm has the ut flag for this (-ut disables utmp updates, +ut enables them), and GNOME Terminal no longer updates utmp directly at all.



So you’re seeing the entries which have been added to utmp in your case: one added by your display manager (on tty7), and others added by some of the terminal emulators you’re using.



It should be possible to wrap commands to add utmp logging to anything you like, using for example libutempter, but that is apparently not as straightforward as one might hope.






share|improve this answer























  • Is it possible to change the configuration of gnome-terminal
    – Debian_yadav
    May 4 at 13:39

















up vote
2
down vote













w does not show terminal sessions. The login database, that the w program reports on, is not a terminal database. (Formally, it is a user accounting database, but the Single Unix Specification is incomplete on this point.)



If it were a terminal database, it would record all of the pseudo terminals that programs use, from the likes of NeoVIM, emacs, tmux, screen, ptybandage, ptyrun, and even script. But it does not, and it is not.



(One can make a similar argument, that needs a slightly greater knowledge of history, about it not recording "call out" terminal usage and the likes of BBS, FidoNet, and UUCP terminal sessions.)



As a login database, it records login sessions, both textual and graphical. The libvte people make the argument that writing to this database is within the purview of the login subsystems, graphical and textual, not within the purview of a terminal emulator that runs within login sessions. This is a fair point, bolstered by the fact that it makes a nonsense of the security of login accounting to allow programs outwith the Trusted Computing Base to write/update the login database.



As such, you shouldn't expect every terminal emulator session to show up as a login session in the login database — or indeed any terminal emulator sessions. Even terminal emulators that are invoking login shells are not doing any actual logging on to the system, and are acting entirely within an already-logged-in session. Terminal emulator writers tried to make the login database record terminal emulator sessions, but the effort has led to a number of problems, long-since recognized.



Conversely, you should expect to see a single record for your GUI login session. (Although, as explained in an article in further reading, in practice this is rather a mess.)



Further reading



  • Jonathan de Boyne Pollard (2018). The Unix login database. Frequently Given Answers.

  • https://unix.stackexchange.com/a/437762/5132


  • pututxline. Base Specifications. IEEE 1003.1:2017. The Open Group.





share|improve this answer





















  • Thanks for the informative answer. However, I don't really understand this part: "it makes a nonsense of the security of login accounting to allow programs outwith the Trusted Computing Base to write/update the login database."
    – Anthony Geoghegan
    Jul 6 at 10:28










  • It just occurred to me that outwith may have been intended as outwit. Maybe, undermine might be a better word - but I'm not particularly familiar with the concept of Trusted Computing Base.
    – Anthony Geoghegan
    Jul 6 at 13:55










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',
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%2funix.stackexchange.com%2fquestions%2f441717%2fw-command-doesnt-show-all-pseudo-terminal-sessions%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote



accepted










w displays the information stored in utmp (/var/run/utmp typically on Linux systems). This generally is only updated by “login” sessions, i.e. login (for logins on virtual consoles or serial connections), the display manager (for graphical sessions), the SSH server (for SSH connections), and some (most?) terminal emulators. In the latter case, whether or not they update utmp depends on their built-in support and configuration; for example xterm has the ut flag for this (-ut disables utmp updates, +ut enables them), and GNOME Terminal no longer updates utmp directly at all.



So you’re seeing the entries which have been added to utmp in your case: one added by your display manager (on tty7), and others added by some of the terminal emulators you’re using.



It should be possible to wrap commands to add utmp logging to anything you like, using for example libutempter, but that is apparently not as straightforward as one might hope.






share|improve this answer























  • Is it possible to change the configuration of gnome-terminal
    – Debian_yadav
    May 4 at 13:39














up vote
4
down vote



accepted










w displays the information stored in utmp (/var/run/utmp typically on Linux systems). This generally is only updated by “login” sessions, i.e. login (for logins on virtual consoles or serial connections), the display manager (for graphical sessions), the SSH server (for SSH connections), and some (most?) terminal emulators. In the latter case, whether or not they update utmp depends on their built-in support and configuration; for example xterm has the ut flag for this (-ut disables utmp updates, +ut enables them), and GNOME Terminal no longer updates utmp directly at all.



So you’re seeing the entries which have been added to utmp in your case: one added by your display manager (on tty7), and others added by some of the terminal emulators you’re using.



It should be possible to wrap commands to add utmp logging to anything you like, using for example libutempter, but that is apparently not as straightforward as one might hope.






share|improve this answer























  • Is it possible to change the configuration of gnome-terminal
    – Debian_yadav
    May 4 at 13:39












up vote
4
down vote



accepted







up vote
4
down vote



accepted






w displays the information stored in utmp (/var/run/utmp typically on Linux systems). This generally is only updated by “login” sessions, i.e. login (for logins on virtual consoles or serial connections), the display manager (for graphical sessions), the SSH server (for SSH connections), and some (most?) terminal emulators. In the latter case, whether or not they update utmp depends on their built-in support and configuration; for example xterm has the ut flag for this (-ut disables utmp updates, +ut enables them), and GNOME Terminal no longer updates utmp directly at all.



So you’re seeing the entries which have been added to utmp in your case: one added by your display manager (on tty7), and others added by some of the terminal emulators you’re using.



It should be possible to wrap commands to add utmp logging to anything you like, using for example libutempter, but that is apparently not as straightforward as one might hope.






share|improve this answer















w displays the information stored in utmp (/var/run/utmp typically on Linux systems). This generally is only updated by “login” sessions, i.e. login (for logins on virtual consoles or serial connections), the display manager (for graphical sessions), the SSH server (for SSH connections), and some (most?) terminal emulators. In the latter case, whether or not they update utmp depends on their built-in support and configuration; for example xterm has the ut flag for this (-ut disables utmp updates, +ut enables them), and GNOME Terminal no longer updates utmp directly at all.



So you’re seeing the entries which have been added to utmp in your case: one added by your display manager (on tty7), and others added by some of the terminal emulators you’re using.



It should be possible to wrap commands to add utmp logging to anything you like, using for example libutempter, but that is apparently not as straightforward as one might hope.







share|improve this answer















share|improve this answer



share|improve this answer








edited May 4 at 13:55


























answered May 4 at 12:29









Stephen Kitt

140k22302363




140k22302363











  • Is it possible to change the configuration of gnome-terminal
    – Debian_yadav
    May 4 at 13:39
















  • Is it possible to change the configuration of gnome-terminal
    – Debian_yadav
    May 4 at 13:39















Is it possible to change the configuration of gnome-terminal
– Debian_yadav
May 4 at 13:39




Is it possible to change the configuration of gnome-terminal
– Debian_yadav
May 4 at 13:39












up vote
2
down vote













w does not show terminal sessions. The login database, that the w program reports on, is not a terminal database. (Formally, it is a user accounting database, but the Single Unix Specification is incomplete on this point.)



If it were a terminal database, it would record all of the pseudo terminals that programs use, from the likes of NeoVIM, emacs, tmux, screen, ptybandage, ptyrun, and even script. But it does not, and it is not.



(One can make a similar argument, that needs a slightly greater knowledge of history, about it not recording "call out" terminal usage and the likes of BBS, FidoNet, and UUCP terminal sessions.)



As a login database, it records login sessions, both textual and graphical. The libvte people make the argument that writing to this database is within the purview of the login subsystems, graphical and textual, not within the purview of a terminal emulator that runs within login sessions. This is a fair point, bolstered by the fact that it makes a nonsense of the security of login accounting to allow programs outwith the Trusted Computing Base to write/update the login database.



As such, you shouldn't expect every terminal emulator session to show up as a login session in the login database — or indeed any terminal emulator sessions. Even terminal emulators that are invoking login shells are not doing any actual logging on to the system, and are acting entirely within an already-logged-in session. Terminal emulator writers tried to make the login database record terminal emulator sessions, but the effort has led to a number of problems, long-since recognized.



Conversely, you should expect to see a single record for your GUI login session. (Although, as explained in an article in further reading, in practice this is rather a mess.)



Further reading



  • Jonathan de Boyne Pollard (2018). The Unix login database. Frequently Given Answers.

  • https://unix.stackexchange.com/a/437762/5132


  • pututxline. Base Specifications. IEEE 1003.1:2017. The Open Group.





share|improve this answer





















  • Thanks for the informative answer. However, I don't really understand this part: "it makes a nonsense of the security of login accounting to allow programs outwith the Trusted Computing Base to write/update the login database."
    – Anthony Geoghegan
    Jul 6 at 10:28










  • It just occurred to me that outwith may have been intended as outwit. Maybe, undermine might be a better word - but I'm not particularly familiar with the concept of Trusted Computing Base.
    – Anthony Geoghegan
    Jul 6 at 13:55














up vote
2
down vote













w does not show terminal sessions. The login database, that the w program reports on, is not a terminal database. (Formally, it is a user accounting database, but the Single Unix Specification is incomplete on this point.)



If it were a terminal database, it would record all of the pseudo terminals that programs use, from the likes of NeoVIM, emacs, tmux, screen, ptybandage, ptyrun, and even script. But it does not, and it is not.



(One can make a similar argument, that needs a slightly greater knowledge of history, about it not recording "call out" terminal usage and the likes of BBS, FidoNet, and UUCP terminal sessions.)



As a login database, it records login sessions, both textual and graphical. The libvte people make the argument that writing to this database is within the purview of the login subsystems, graphical and textual, not within the purview of a terminal emulator that runs within login sessions. This is a fair point, bolstered by the fact that it makes a nonsense of the security of login accounting to allow programs outwith the Trusted Computing Base to write/update the login database.



As such, you shouldn't expect every terminal emulator session to show up as a login session in the login database — or indeed any terminal emulator sessions. Even terminal emulators that are invoking login shells are not doing any actual logging on to the system, and are acting entirely within an already-logged-in session. Terminal emulator writers tried to make the login database record terminal emulator sessions, but the effort has led to a number of problems, long-since recognized.



Conversely, you should expect to see a single record for your GUI login session. (Although, as explained in an article in further reading, in practice this is rather a mess.)



Further reading



  • Jonathan de Boyne Pollard (2018). The Unix login database. Frequently Given Answers.

  • https://unix.stackexchange.com/a/437762/5132


  • pututxline. Base Specifications. IEEE 1003.1:2017. The Open Group.





share|improve this answer





















  • Thanks for the informative answer. However, I don't really understand this part: "it makes a nonsense of the security of login accounting to allow programs outwith the Trusted Computing Base to write/update the login database."
    – Anthony Geoghegan
    Jul 6 at 10:28










  • It just occurred to me that outwith may have been intended as outwit. Maybe, undermine might be a better word - but I'm not particularly familiar with the concept of Trusted Computing Base.
    – Anthony Geoghegan
    Jul 6 at 13:55












up vote
2
down vote










up vote
2
down vote









w does not show terminal sessions. The login database, that the w program reports on, is not a terminal database. (Formally, it is a user accounting database, but the Single Unix Specification is incomplete on this point.)



If it were a terminal database, it would record all of the pseudo terminals that programs use, from the likes of NeoVIM, emacs, tmux, screen, ptybandage, ptyrun, and even script. But it does not, and it is not.



(One can make a similar argument, that needs a slightly greater knowledge of history, about it not recording "call out" terminal usage and the likes of BBS, FidoNet, and UUCP terminal sessions.)



As a login database, it records login sessions, both textual and graphical. The libvte people make the argument that writing to this database is within the purview of the login subsystems, graphical and textual, not within the purview of a terminal emulator that runs within login sessions. This is a fair point, bolstered by the fact that it makes a nonsense of the security of login accounting to allow programs outwith the Trusted Computing Base to write/update the login database.



As such, you shouldn't expect every terminal emulator session to show up as a login session in the login database — or indeed any terminal emulator sessions. Even terminal emulators that are invoking login shells are not doing any actual logging on to the system, and are acting entirely within an already-logged-in session. Terminal emulator writers tried to make the login database record terminal emulator sessions, but the effort has led to a number of problems, long-since recognized.



Conversely, you should expect to see a single record for your GUI login session. (Although, as explained in an article in further reading, in practice this is rather a mess.)



Further reading



  • Jonathan de Boyne Pollard (2018). The Unix login database. Frequently Given Answers.

  • https://unix.stackexchange.com/a/437762/5132


  • pututxline. Base Specifications. IEEE 1003.1:2017. The Open Group.





share|improve this answer













w does not show terminal sessions. The login database, that the w program reports on, is not a terminal database. (Formally, it is a user accounting database, but the Single Unix Specification is incomplete on this point.)



If it were a terminal database, it would record all of the pseudo terminals that programs use, from the likes of NeoVIM, emacs, tmux, screen, ptybandage, ptyrun, and even script. But it does not, and it is not.



(One can make a similar argument, that needs a slightly greater knowledge of history, about it not recording "call out" terminal usage and the likes of BBS, FidoNet, and UUCP terminal sessions.)



As a login database, it records login sessions, both textual and graphical. The libvte people make the argument that writing to this database is within the purview of the login subsystems, graphical and textual, not within the purview of a terminal emulator that runs within login sessions. This is a fair point, bolstered by the fact that it makes a nonsense of the security of login accounting to allow programs outwith the Trusted Computing Base to write/update the login database.



As such, you shouldn't expect every terminal emulator session to show up as a login session in the login database — or indeed any terminal emulator sessions. Even terminal emulators that are invoking login shells are not doing any actual logging on to the system, and are acting entirely within an already-logged-in session. Terminal emulator writers tried to make the login database record terminal emulator sessions, but the effort has led to a number of problems, long-since recognized.



Conversely, you should expect to see a single record for your GUI login session. (Although, as explained in an article in further reading, in practice this is rather a mess.)



Further reading



  • Jonathan de Boyne Pollard (2018). The Unix login database. Frequently Given Answers.

  • https://unix.stackexchange.com/a/437762/5132


  • pututxline. Base Specifications. IEEE 1003.1:2017. The Open Group.






share|improve this answer













share|improve this answer



share|improve this answer











answered May 4 at 16:26









JdeBP

28.1k459133




28.1k459133











  • Thanks for the informative answer. However, I don't really understand this part: "it makes a nonsense of the security of login accounting to allow programs outwith the Trusted Computing Base to write/update the login database."
    – Anthony Geoghegan
    Jul 6 at 10:28










  • It just occurred to me that outwith may have been intended as outwit. Maybe, undermine might be a better word - but I'm not particularly familiar with the concept of Trusted Computing Base.
    – Anthony Geoghegan
    Jul 6 at 13:55
















  • Thanks for the informative answer. However, I don't really understand this part: "it makes a nonsense of the security of login accounting to allow programs outwith the Trusted Computing Base to write/update the login database."
    – Anthony Geoghegan
    Jul 6 at 10:28










  • It just occurred to me that outwith may have been intended as outwit. Maybe, undermine might be a better word - but I'm not particularly familiar with the concept of Trusted Computing Base.
    – Anthony Geoghegan
    Jul 6 at 13:55















Thanks for the informative answer. However, I don't really understand this part: "it makes a nonsense of the security of login accounting to allow programs outwith the Trusted Computing Base to write/update the login database."
– Anthony Geoghegan
Jul 6 at 10:28




Thanks for the informative answer. However, I don't really understand this part: "it makes a nonsense of the security of login accounting to allow programs outwith the Trusted Computing Base to write/update the login database."
– Anthony Geoghegan
Jul 6 at 10:28












It just occurred to me that outwith may have been intended as outwit. Maybe, undermine might be a better word - but I'm not particularly familiar with the concept of Trusted Computing Base.
– Anthony Geoghegan
Jul 6 at 13:55




It just occurred to me that outwith may have been intended as outwit. Maybe, undermine might be a better word - but I'm not particularly familiar with the concept of Trusted Computing Base.
– Anthony Geoghegan
Jul 6 at 13:55












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441717%2fw-command-doesnt-show-all-pseudo-terminal-sessions%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)