Thursday, January 15, 2015

Get pid, user and command for the particular port in illumos

While the Solaris has the updated netstat with -u flag, illumos requires certain improvements in sockinfo, and possibly, rpcbind (tcpConnCreationProcess shows the old PID for rpcbind, until it did not become a demon). With help of pfiles is possible to obtain the desired information about pid for particular port, so I wrote a small pfiles-based utility which allows to determine the PID, user and command for the particular port:

# ./ptcpstat
PROTO           IP               PORT   PID    USER     COMMAND
--------  -------------------    ----- ------ -------- ------------------
AF_INET              25    692    root      /usr/lib/smtp/sendmail/sendmail -bl -q15m
AF_INET6  ::1                    25    692    root      /usr/lib/smtp/sendmail/sendmail -bl -q15m
AF_INET              587   692    root      /usr/lib/smtp/sendmail/sendmail -bl -q15m
AF_INET6  ::                     22    605    root      /usr/lib/ssh/sshd
AF_INET6  ::                     0     495    root      /usr/lib/inet/in.ndpd
AF_INET                520   637    root      /usr/sbin/in.routed
AF_INET                0     637    root      /usr/sbin/in.routed
AF_INET                10004 685    root      /usr/bin/python2.6 /usr/lib/pkg.depotd --cfg svc:/application/pkg/server:test
AF_INET                10000 9354   root      /usr/bin/python2.6 /usr/lib/pkg.depotd --cfg svc:/application/pkg/server:zfs
AF_INET6  ::ffff:     22    2315   root      /usr/lib/ssh/sshd
AF_INET6  ::ffff:       56027 2315   root      /usr/lib/ssh/sshd
AF_INET                80    1402   root      /usr/bin/python2.6 /usr/lib/pkg.depotd --cfg svc:/application/pkg/server:defaul
AF_INET6  ::ffff:     22    2314   root      /usr/lib/ssh/sshd
AF_INET6  ::ffff:       56027 2314   root      /usr/lib/ssh/sshd

No comments:

Unleashed - an operating system fork of illumos

If someone looking for the operating system with ZFS, DTrace and other illumos-buns, system that has been a bit cleared from the some ...