Menu

#50 Proposal: Increase PROGNAME_WIDTH or make -W change it

BETA-1.65-UPSTREAM
open
nobody
None
5
2025-03-17
2025-03-17
No

For many years, it's been super convenient to tie the sockets of individual sshd child processes to the authenticated user via netstat -p:

# netstat -antp | egrep 'EST.*sshd'
tcp        0     36 127.0.0.1:22         127.0.0.1:20560        ESTABLISHED 226228/sshd: foo  

Recent openssh changed/improved their process separation so that these children are called sshd-session, which means the process information gets truncated before the username:

tcp        0      0 127.0.0.1:22      127.0.0.1:40222      ESTABLISHED 5266/sshd-session:

netstat has a -W / --wide flag to prevent truncation, but... it has no impact on process name width, which is defined in netstat.c:

#define PROGNAME_WIDTH 20

In this case root always owns the actual process that owns the socket, so that's no help, we actually need it from the proctitle, or go rummaging around looking up the process tree, etc. For the same reason neither netstat -...e nor ss -...e give the desired info. (ss's -p also only prints the process name, not full proctitle, it seems, but that's neither here nor there.)

It would be great if this was adjustable at runtime via the -W flag. Short of that, I propose it be bumped from 20 to 30. -antp output is already wider than a default terminal width, so if there's a 70-80 char soft limit, we're already past it.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB