Why are the arguments supplied for the command run through ssh interpreted by shell before they are passed to the command on the server side?

Yuri yuri at rawbw.com
Sun Jan 12 03:19:44 AEDT 2020


On 2020-01-11 05:38, Colin Watson wrote:
> I do think it's a problem that, as far as I can see, the exact behaviour
> of ssh command interpretation isn't explained anywhere in its man pages,
> even though it seems like the only possibility if you understand the
> protocol.  ssh(1) just says "If command is specified, it is executed on
> the remote host instead of a login shell", but that doesn't provide any
> hint about what quoting of metacharacters might be required, which is
> important since ssh is often used as plumbing.


A practical problem stemming from this is "how to pass a string to the 
server verbatim". I just escaped every character with '\'. But is this 
excessive, or generally sufficient? I can't tell since it isn't clear 
how the arguments are processed, and by what shell. It's not documented.


Yuri




More information about the openssh-unix-dev mailing list