ssh 执行任意复杂命令

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

 

MYCOMMAND=$(base64 -w0 script.sh)
ssh user@remotehost "echo $MYCOMMAND | base64 -d | sudo bash"

base64 script | ssh remotehost 'base64 -d | sudo bash'

posted on 2018-01-23 13:25  reedlau  阅读(250)  评论(0编辑  收藏  举报

导航