Updated Remote command line escaping rules (markdown)

Yanbing 2019-01-14 12:53:34 -08:00
parent 1da94eeac1
commit 3580b6dc5e

@ -1,13 +1,12 @@
OpenSSH follow the below rules to determine if the " and \ in shell arguments are escaped or not
Here are examples to print out "hello" on different shells
| DefaultShell | DefaultShellEscapeArguments |Example to print out "hello" <br/>(client cmd run in cmd prompt)| Notes |
|:--|:--|:--|:--|
| powershell | N/A | ``c:\>ssh.exe localhost echo `\"hello`\"`` | PS strip the " |
| bash | N/A | to be added | |
| cygwin | N/A | to be added | |
| cmd.exe | N/A | `c:\>ssh.exe localhost echo \"hello\"` | |
| ssh-shellhost.exe | N/A | to be added | |
| shells other than above | 1, not set | | |
| shells other than above | 0 | | |
| DefaultShell | cmd to print on local shell | cmd to print on remote shell (client cmd run in cmd prompt) |
|:--|:--|:--|
| powershell | ``echo `"hello`"`` |``c:\>ssh.exe winbox echo `\"hello`\"`` |
| bash | ``echo '"hello"'``<br/> or ``echo \"hello\"``| ``c:\>ssh winbox 'echo \"hello\"'``<br/> or `c:\>ssh.exe winbox echo \\\"hello\\\"` <br/> or `c:\>ssh winbox echo '\"hello\"'` |
| cygwin | ``echo '"hello"'``<br/> or ``echo \"hello\"``| ``c:\>ssh winbox 'echo \"hello\"'``<br/> or `c:\>ssh.exe winbox echo \\\"hello\\\"` <br/> or `c:\>ssh winbox echo '\"hello\"'` |
| cmd.exe | `echo "hello"` | `c:\>ssh.exe winbox echo \"hello\"` |
| ssh-shellhost.exe | to be added | to be added |
Please refer to [DefaultShell](https://github.com/PowerShell/Win32-OpenSSH/wiki/DefaultShell) for setting DefaultShell and DefaultShellEscapeArguments.