Re:SSH quoting
by zeroimpl on Saturday June 12, 2021 @01:06PM
(#27485808)
Why not just this:
So far that has worked fine for me. Curious when base64 is required?
[ Parent
| on HN ]
I tend to save the base64 output sometimes and just run
ssh $server "echo <base64-string> | base64 -d | bash"
and I can check later wth I was running earlier.
Other than that, it just makes it kinda obvious that it will not break in any scenario, period. It just feels better, make sense?
As someone wrote here avoiding the expansion issues is really nice.
It is also very easy to compress with xz, but hey, then you could just use xz to begin with! Well, I don't know how wierd binary data will effect stdout in all scenarios. So yet again I stay with safe. I know that you send tar and what not over ssh pipes, but I really don't trust bash that much.
Another nice way would be
ssh $server bash <<'EOF' echo hello world EOF
You could not use the stdin then sadly, but that I solvable.
Did you read the original article? It is mainly talking about the problems with this approach.