[BUG?] sftp is echoing back prompt and commands in batch mode

Iain Morgan imorgan at nas.nasa.gov
Sat Nov 3 06:03:25 AEDT 2018


If you truly intend this as a bug report, you should file it at
bugzilla.mindrot.org.

On Fri, Nov 02, 2018 at 12:25:22 +0100, Vincenzo Romano wrote:
> Short description: All comands sent to server in batch mode are being
> echoed back along with prompt.
> Software Version: "OpenSSH_7.9p1, OpenSSL 1.1.1  11 Sep 2018" (as
> printed by ssh -V)
> Server and client systems: ArchLinux x86_64 fully updated as of 2018-11-02.
> 
> ## How to reproduce
> 
> Provided that you have proper SSH key authentication in place, from
> command line run:
> echo "dir /var" | sftp -b - 0
> 
> ## Expected output
> 
> /var/backups    /var/cache      /var/lib        /var/local      /var/lock
> /var/log        /var/mail       /var/opt        /var/puppet     /var/run
> /var/spool      /var/tmp        /var/www
> 
> ## Actual output
> 
> sftp> dir /var
> /var/backups    /var/cache      /var/lib        /var/local      /var/lock
> /var/log        /var/mail       /var/opt        /var/puppet     /var/run
> /var/spool      /var/tmp        /var/www
> 
> Please note the first line is the server prompt followed by the command echo.
> 
> ## Workaround
> 
> Expunge the first line from the client output
> echo "dir /var" | sftp -b - 0 | tail -n +2
> 
> ## Notes
> Batch mode is meant for script automation, not human operations, so
> echoing the prompt and the commands doesn't make any sense and creates
> problems while processing the output.
> A possible solution that's also backward compatible with all scripts
> using batch mode is to allow for a special prefix character to
> commands to avoid any echoing, just like the "-" is used to avoid a
> single failing command to terminate the client. Something like "@" or
> "#" would be ok IMHO.
> 
> -- 
> Vincenzo Romano - NotOrAnd.IT
> Information Technologies
> --
> NON QVIETIS MARIBVS NAVTA PERITVS
> _______________________________________________
> openssh-unix-dev mailing list
> openssh-unix-dev at mindrot.org
> https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev

-- 
Iain Morgan


More information about the openssh-unix-dev mailing list