Skip to content

Cannot set terminal modes

I'm trying to replace the use of the OpenSSH ssh client binary in my library with libssh. I'm using ssh_channel_request_pty_size to open a remote shell and communicate with an interactive program, however there's a difference/problem in CR/NL handling: The OpenSSH binary encodes and sends terminal modes (according to RFC 4254), which the sshd then evaluates and applies to the created PTY. libssh doesn't support these modes AFAIS, so that the server opens the PTY with "default" modes, and that includes options like "icrnl" (which converts all \r into \n) and/or "igncr" (which removes all \r). Long story short: I'm sending "\r\n" with libssh, but the server process sees either "\n" or "\n\n" (depends on various factors, e.g. an intermediate shell).

Is it possible to add support for sending terminal modes in the PTY request or is there even a way to realize this with the current libssh version?

Thanks!

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information