IETF-SSH archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Where to find protocol spec for SCP under SSH-1



Karol.Zielonko%hp.com@localhost (Karol Zielonko) writes:

> In our implementation of SSH stderr turns out to be the PTY going to the SSH
> server parent process and all data sent to the PTY from the child (which is
> running the "scp -f file.name" command) ends up being sent over the encrypted
> channel to the client.

I guess this is where you get stderr and stdout mixed up.

> The point is that I want to be able to package the error text data being sent
> back to the client in such a way that the client recognizes the data as error
> text and displays it to the user as such.

I think the Right Way to do this is to have sshd spawn the process
with a pty only for its stdin and stdout, and a plain pipe for stderr.
And then forward data from the stderr pipe as
SSH_MSG_CHANNEL_EXTENDED_DATA. Then the ssh client end has sufficient
information to do the right thing. And I'd expect most instances of
foo-over-ssh will Just Work, as the ssh client will forward data
between the ssh connection and the foo application, and direct and
SSH_MSG_CHANNEL_EXTENDED_DATA to the terminal.

Unfortunately, on the server side, some interactive programs, e.g.
bash, are confused if stderr is a pipe or other non-tty. If that is a
problem, you can have sshd create *two* pty pairs, one for
stdin/stdout, and one for stderr. Slightly overkill, but it should
work.

Regards,
/Niels



Home | Main Index | Thread Index | Old Index