openssh-unix-dev Digest, Vol 11, Issue 28

Jeremy McMillan aphor at speakeasy.net
Fri Mar 26 00:52:21 EST 2004


The shell that executes on the remote server takes input in the form of  
shell commands before it issues a prompt. When you redirect commands  
from ssh client to a shell on the remote server there is usually a  
trailing EOF to tell the shell to exit. If the shell gets an EOF it  
should not respond with a prompt. Also, some shells decide whether or  
not to issue a prompt by TTY detection.

What about inserting something into your command string to duplicate  
what you expect a telnet prompt to do:

    echo "command -a;echo ###DONE###;command -b;echo ###DONE###" | ssh  
remotuser at host | grep '^###DONE###$' | ( while read line; do echo  
"Anotherone bitesthedust..."; done )


On Mar 25, 2004, at 2:14 AM, Niclas B?ckman C (LI/EAB) wrote:

> Message: 8
> Date: Thu, 25 Mar 2004 08:33:58 +0100
> From: Niclas B?ckman C (LI/EAB) 	<niclas.c.backman at ericsson.com>
> Subject: RE: Where does the "prompt come from"
> To: "'Damien Miller'" <djm at mindrot.org>
> Cc: "'openssh-unix-dev at mindrot.org'" <openssh-unix-dev at mindrot.org>
> Message-ID:
> 	 
> <A943FD84BD9ED41193460008C79180500A4774BF at ESEALNT419.al.sw.ericsson.se>
> 	
> Content-Type: text/plain;	charset="iso-8859-1"
>
> 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
>
---
Jeremy McMillan




More information about the openssh-unix-dev mailing list