Re: 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?

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



On Sat, 11 Jan 2020 at 12:46, Yuri <yuri@xxxxxxxxx> wrote:

> If "echo" is interpreted as a login shell, who interprets "`hostname`"
> as "remote-host-name" then, and why?
>

Echo is not used as a login shell.

In both cases it uses your shell, the difference being that in the "ssh
foo" case it runs a shell with arguments indicating it's an interactive
login (ie a "login shell" which is indicated by a leading "-" in its argv,
and usually enables features like job control).  In the other case, it's
run via the shell using $SHELL -c "your command".

>
> I found that in order to pass the string to the command run on the
> remote host verbatim it is necessary to escape every character in it,
> but it isn't clear why should this be necessary.
>

The command you give is always handled on the server by your shell in some
fashion.  It has to be, because SSH only specifies an opaque string for the
remote command, so without doing so you would not be able to specify
arguments at all.

-- 
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860  37F4 9357 ECEF 11EA A6FA (new)
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev



[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux