[Bug 2563] New: ssh bash -c drops arguments of the first command send to the remote.

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Fri Apr 8 19:40:55 AEST 2016


https://bugzilla.mindrot.org/show_bug.cgi?id=2563

            Bug ID: 2563
           Summary: ssh bash -c drops arguments of the first command send
                    to the remote.
           Product: Portable OpenSSH
           Version: 6.9p1
          Hardware: ix86
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P5
         Component: ssh
          Assignee: unassigned-bugs at mindrot.org
          Reporter: pjb at informatimago.com

$ ssh -n -x -T $remote /bin/bash -c 'echo a b c'
doesn't execute ssh 


$ /bin/bash -c 'echo a b c'
a b c
$ /bin/bash -c '/bin/bash -c "echo a b c"'
a b c
$  ssh -n -x -T localhost /bin/bash -c 'echo a b c'

$  ssh -n -x -T localhost /bin/bash -c ':;echo a b c'
a b c

$ rm bar
$ ssh localhost /bin/bash -c 'echo foo bar baz > ~/bar'
X11 forwarding request failed on channel 0
$ cat bar

$ rm bar
$ ssh -x -n -T localhost /bin/bash -c 'printf "%s\n" foo bar baz >
~/bar'
printf: usage: printf [-v var] format [arguments]
$ ssh -x -n -T localhost /bin/bash -c 'echo foo foo foo;echo bar bar
bar'

bar bar bar
$ 

So, strangely enough, only the arguments of the first command are
removed; the command itself and the redirection are transmitted and
executed, as well as the following commands if any.


This occurs the same way on linux and on MacOSX (with bash 4.3 on
Linux, bash 3.2 on MacOSX) and the following versions of ssh; and this
occurs the same way whether we ssh to localhost, or remotely to a
different system.

$ ssh -V
OpenSSH_6.7p1 Debian-5+deb8u1, OpenSSL 1.0.1k 8 Jan 2015
$ 

$ ssh -V
OpenSSH_6.9p1, LibreSSL 2.1.8

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list