Monday, May 1, 2017

Execute arbitrary commands remotely

NOTE

FROM: https://serverfault.com/questions/625641/how-can-i-run-arbitrarily-complex-command-using-sudo-over-ssh

Pass a complex script to be executed over SSH.

ssh -tt @ "echo `base64 test.sh` | base64 -d | sudo bash"

The key is to base64 encode locally and decode it remotely in order to execute it correctly.

No comments:

Post a Comment