News for hackers. Stuff that matters.
Re:SSH quoting by zeroimpl on Saturday June 12, 2021 @01:06PM (#27485808)
Why not just this:

    ssh $server "$(cat script)"
So far that has worked fine for me. Curious when base64 is required?
Re:SSH quoting by isodude on Saturday June 12, 2021 @04:09PM (#27487125)
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.

Re:SSH quoting by Too on Sunday June 13, 2021 @04:59AM (#27490971)
Did you read the original article? It is mainly talking about the problems with this approach.
Re:SSH quoting by zeroimpl on Tuesday June 15, 2021 @09:06AM (#27514786)
Doing it the way I suggest is directly in line with their final recommendation of passing the whole script as a single string.