[Bug 2094] Executing commands via ssh on a remote host has different parameter passing properties

bugzilla-daemon at natsu.mindrot.org bugzilla-daemon at natsu.mindrot.org
Thu Oct 24 10:59:27 EST 2013


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

Darren Tucker <dtucker at zip.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dtucker at zip.com.au

--- Comment #2 from Darren Tucker <dtucker at zip.com.au> ---
I think you meant "rsh" not "rcp".

Anyway, here's how RFC4254 defines the protocol message to run a remote
command (section 6.5):

      byte      SSH_MSG_CHANNEL_REQUEST
      uint32    recipient channel
      string    "exec"
      boolean   want reply
      string    command

   This message will request that the server start the execution of the
   given command.  The 'command' string may contain a path.  Normal
   precautions MUST be taken to prevent the execution of unauthorized
   commands.

Note that there's only a single string for the command, there's no
facility to pass a list of args other than quoting it.  Exactly what
quoting is required is dependent on the user's shell at the other end.

You can work around some quoting issues by doing something like this:

$ ssh <<EOF localhost /bin/sh
echo "'quoted"
EOF
'quoted

instead of

$ ssh localhost echo "'quoted"
bash: -c: line 0: unexpected EOF while looking for matching `''
bash: -c: line 1: syntax error: unexpected end of file

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.


More information about the openssh-bugs mailing list