#1109585 procps: the 'w' command doesn't show multiple sessions in one ssh connection

Package:
procps
Source:
procps
Description:
/proc file system utilities
Submitter:
Mikulas Patocka
Date:
2025-12-08 07:55:04 UTC
Severity:
normal
#1109585#5
Date:
2025-07-20 12:21:53 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?

Recently, the 'w' command stopped showing sessions when there are multiple
sessions in the same ssh connection.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

1. Set up ssh so that it uses shared connection for multiple sessions:
   add these lines to /etc/ssh/ssh_config
ControlMaster   auto
ControlPath     ~/.ssh/socket-%h-%p-%r
ControlPersist  60

2. Open multiple terminals and create multiple connection to the same ssh
   host that is running Debian Sid or Trixie

3. Run 'w' in one of the sessions on the remote host

   * What was the outcome of this action?

You get output like:
 14:11:00 up 32 min,  2 users,  load average: 1,03, 1,53, 1,21
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU  WHAT
mikulas  pts/0    192.168.1.1      13:59   11:16   8:25   8:25  w

'w' shows only one line despite the fact that there are multiple
    connections

   * What outcome did you expect instead?

You should see separate line for each session, such as:
 14:11:00 up 32 min,  3 users,  load average: 1,03, 1,53, 1,21
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU  WHAT
mikulas  pts/0    192.168.1.1      13:59   11:16   8:25   8:25  w
mikulas  pts/1    192.168.1.1      13:59   11:16   8:25   8:25  -bash
mikulas  pts/2    192.168.1.1      13:59   11:16   8:25   8:25  -bash

*** End of the template - remove these template lines ***




Note that on systems with sysvinit and without systemd, it 'w' shows
multiple lines, but all the lines show the same terminal and the same
command. For example this:
 14:15:43 up 15 min,  3 users,  load average: 0,00, 0,00, 0,00
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU  WHAT
mikulas  pts/2    192.168.1.1      14:15    0.00s  0.01s   ?    w
mikulas  pts/2    192.168.1.1      14:15    0.00s  0.01s   ?    w
mikulas  pts/2    192.168.1.1      14:15    0.00s  0.01s   ?    w

#1109585#10
Date:
2025-07-28 21:27:21 UTC
From:
To:
w gets that information from systemd. Could you tell me what the output of
loginctl
is?

It might be that systemd thinks it is a single user, they also did
something in the libsystemd
library around ssh sessions to fix some tty issues.

 - Craig

#1109585#15
Date:
2025-12-08 07:42:20 UTC
From:
To:
systemd does think its a single user.
$ loginctl
SESSION  UID USER   SEAT  LEADER CLASS   TTY  IDLE SINCE
     14 1000 csmall -     17723  user    -    no   -
      3 1000 csmall seat0 4591   user    tty2 no   -
      4 1000 csmall -     4614   manager -    no   -

The new -t flag does show them.
$ src/w -tf
 18:40:51 up  1:05,  2 users,  load average: 0.11, 0.18, 0.21
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU  WHAT
[.. snip ..]
csmall   pts/4    127.0.0.1        18:36    2:40   0.01s  0.01s -bash
csmall   pts/5    127.0.0.1        18:36    1:46   0.03s  0.03s -bash

 - Craig