6 ms·
Why not just this: ssh $server "$(cat script)" So far that has worked fine for me. Curious when base64 is required?
by zeroimpl 5y ago
Why not just this:
ssh $server "$(cat script)"
So far that has worked fine for me. Curious when base64 is required?
- isodude 5y agoI 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.
- Too 5y agoDid you read the original article? It is mainly talking about the problems with this approach.
- zeroimpl 5y agoDoing it the way I suggest is directly in line with their final recommendation of passing the whole script as a single string.