Darren Tucker
2023-Mar-02 01:40 UTC
Uniquely Identifying the Local TTY of an SSH Connection
On Thu, 2 Mar 2023 at 00:12, Ethan Pailes <ethan at pailes.org> wrote: [...]> this works quite well, except that $SSH_TTY holds the path of the > remote pty rather than the local pty, so there is nothing that ensures > that you will reconnect to the same session if you ssh back into your > remote machine from the same local terminal emulator. > > First of all, can anyone think of some obvious thing I'm missing that > will make this easier? Perhaps there is some config feature of > environment variable ssh sets or can be persuaded to set that I've > missed. If so, apologies for the noise.Send the local tty name using SendEnv? You'd probably want to include some kind of host identifier so you don't get collisions if sshing in from multiple machines (although that might not matter for your use case). SendEnv variables are not accepted by default on the server side, so if you don't control the server you could maybe pack them into $TERM (which is required by the protocol for pty requests), although you'll need to unpack it on the server side before trying to use anything that cares about TERM. $ TERM="vt100 myhost:/dev/pts/0" ssh localhost Last login: Thu Mar 2 12:28:59 2023 from 127.0.0.1 $ echo $TERM vt100 myhost:/dev/pts/0> Finally, some administrative notes: I wasn't able to sign up for this > mailing list at > https://lists.mindrot.org/mailman/subscribe/openssh-unix-dev because > attempts to do so were met by a "Bug in Mailman version 2.1.39" page.I just tried that and didn't get that error, although I also haven't got the confirmation email yet. Could you please try again and if it happens again. mail me the error message off-list? -- Darren Tucker (dtucker at dtucker.net) GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.
Ethan Pailes
2023-Mar-02 01:46 UTC
Uniquely Identifying the Local TTY of an SSH Connection
Packing the data in TERM is a great idea! I?ll see what I can do with that.>> Finally, some administrative notes: I wasn't able to sign up for this >> mailing list at >> https://lists.mindrot.org/mailman/subscribe/openssh-unix-dev because >> attempts to do so were met by a "Bug in Mailman version 2.1.39" page. > > I just tried that and didn't get that error, although I also haven't > got the confirmation email yet. Could you please try again and if it > happens again. mail me the error message off-list?yeah I got that worked out and forgot to delete that part of my message when I resent it. Sorry about that.>
Apparently Analagous Threads
- Uniquely Identifying the Local TTY of an SSH Connection
- Uniquely Identifying the Local TTY of an SSH Connection
- Uniquely Identifying the Local TTY of an SSH Connection
- [Bug 1330] New: RFE: 'ControlPersist' support -- automatically fork and leave ControlMaster behind as a dæmon
- Problemes with ControlPersist