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. I would be most greatful for any good ideas/hints in this case. Thanks in advance !! e Niclas B?ckman Software Design | OMSec - team SSH Ericsson AB Center for Radio Network Control Box 1248 581 12 Link?ping Sweden New e-mail address:> * E-mail: : Niclas.c.Backman at ericsson.comPlease Update your address book.> * Phone : +46 13 287604 > * Mobile : +46 73 0435819 > >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.
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
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.