getting system's telnet sessions' pid per pty

takCoder tak.official at
Wed Jun 5 16:56:54 UTC 2013

Hi everyone :)

Do you have any ideas how i can separate telnet session's pid per pty it
uses ??

i have written a reporter shell which prints out all current remote
sessions' pid per tty per user. My shell uses 'pstree' tool together with
'w' command outputs to do so.

Everything is fine. I just can't figure it out when one user makes more
than one telnet session to my system! i have all of that user's telnet
sessions' pids, but i can not figure it out to which pts they are related.

if only i could trust on increasing pid assignment!! then i could use time
entry in 'w' command's output to relate them.. Also, I'd rather not to keep
old data of the time each session is created in a common structure to use
it later on as well, i am trying to generate this list dynamically, based
on current sessions available while calling my shell, using the tty which
runs it..

any ideas? any other command line tools which may help me?? any command
which gives me pid per tty information or alike?

Looking forward to any helpful  points and ideas from you all.. :)

Best Regards,

More information about the freebsd-questions mailing list