3 ms·
The problem is that the quote signs are already eaten by your local shell. The SSH binary gets the parameters like this: ['sh', '-c', 'cd /tmp && pwd'] Ho
by janosdebugs 3y ago
The problem is that the quote signs are already eaten by your local shell. The SSH binary gets the parameters like this:
['sh', '-c', 'cd /tmp && pwd']
How should SSH know what shell is running on the other end and escape it properly? Will it escape for Sh? Bash? Fish? Powershell? Python shell? Custom script? The SSH client would need to know what shell is running on the other end, which it can't. The server, which knows what will run, cannot fix this because it only gets the already mangled string.
This is not solvable the way the protocol currently works because you can't support all possible constellations of client/server applications and shells.
- btilly 3y agoThis. Exactly this. Rule 5 of http://cr.yp.to/qmail/guarantee.html http://cr.yp.to/qmail/guarantee.html remains completely true. Don't parse. When you try to use a user interface as a command interface, you have to parse. And some day it will bite you. The solution is to remotely invoke programs designed for the purpose, and then pass data to them in a structured format.
- Joker_vD 3y agoBy the way, I had to use Powershell over ssh a couple of times (don't ask) and it works perfectly fine.