Is possible to have some Unix (either just in Linux) 'engine' mounting the pts'es (terminals) names according to their IP (socket) source ?

In the past we could map each physical ports to its tty name like /dev/tty0 to serial port 0, and so on, we could recognize its physical origin just with the name, now with 'virtual terminals', how we could do something similar but directly to the tty name ?

In my mind, would be very useful a name like /dev/ptssocket/ for terminals from a tcp/ip connection and another like /dev/pts/0 to terminals not associated to a remote tcp/ip connection.

Of course, this is more useful in a network where the IPs have some meaning.

EDIT - Sample of use: We may have a lot of use cases for that, but consider a legacy system where the ports are used in an access control, where some origins can and others cannot do something.

  • just curious..how did you map physical port to tty name ? – rajaganesh87 May 21 '15 at 6:37
  • It's system dependent. In some systems each port number is incremented starting in, lets say 1, when you add a new serial multiplexer, the new ports continue to increment from the last number (AIX fashion), but in others, you have a compound number like 1a, 1b, 2a, 2b, where 1 and 2 the multiplexer number, and a, b the port (SCO fashion with digiboard hardware). Btw you always have an association between hardware and the /dev ports ids. – Luciano May 22 '15 at 15:37
  • Are you looking for something like what who reports (based on utmp information) (or who --ips)? Note that ptys can be used for all sorts of things, not only network terminal sessions. – Stéphane Chazelas May 22 '15 at 15:56
  • @StéphaneChazelas: Yes. We know that ptys is used for a lot of things, but it could be splited, so, one could be the ptys with an ip source. In legacy systems that just uses tty name for some sort of logic that need infers the tty origin, we cannot change it to call another API. – Luciano May 22 '15 at 16:26
  • So, do you want for instance the list of pts that are controlled by a sshd process and for them give the IP address of the peer that spawned that sshd process? – Stéphane Chazelas May 22 '15 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.