Where does the "prompt come from"

Niclas Bäckman C (LI/EAB) niclas.c.backman at ericsson.com
Thu Mar 25 18:33:58 EST 2004


Hi Damien !
Thanks for your feedback !
We have implemented a secure command line interface api that wants to perform "normal" shell
operations, but from an application. 
That's why I don't want to add a new subsystem.
I just want to run for instance scripts, towards a secured remote host. But the data that is passed
to the socket doesn't include the prompt itself, like '>'. The socket is a redirekt from the client's
stdout/stderr.
If I use a standard client like OpenSSH the client echoes back the prompt after a command is executed,
but in my scenarion it's lost and never written to stdout/stderr(my socket).
Does the SSH client remove the prompt in some way before data is passed to stdout/stderr ??
Many thanks in advance !
/Niclas


-----Original Message-----
From: Damien Miller [mailto:djm at mindrot.org]
Sent: den 25 mars 2004 00:56
To: Niclas Bäckman C (LI/EAB)
Cc: 'openssh-unix-dev at mindrot.org'
Subject: Re: Where does the "prompt come from"


Niclas Bäckman C (LI/EAB) wrote:

> Hi All !
> I have a little question about the shell that is run when establishing a
> connection towards an SSH server.
> The client(OpenSSH) displays a prompt(as usual) when a command is executed,
> but my question is, where does the prompt come from.
> Is it sent by the remote shell or is it handled in the client ??
> 
> The reason I ask is that we have developed a product that redirects
> stdin/stdout/stderr from the ssh binary to a socket, and we then
> perform socket read/writes directly into the ssh tunnel. But when i perform
> a command, the prompt is never read up from the server.
> So it's difficult to know when a remote script is finished. Using the same
> solution but towards a telnet server always results in a prompt
> back to the client.

The prompt comes from the shell that the server executes.

If you want to use OpenSSH as a transport, you should probably invent a
little protocol and implement it as a subsystem. sftp does this.

-d

This communication is confidential and intended solely for the addressee(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you.

E-mail including attachments is susceptible to data corruption, interruption, unauthorized amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof.




More information about the openssh-unix-dev mailing list