Run a local script on a remote server
run local script on remote server ssh | ssh bash -s script | execute script remotely without copying | ssh | bash | automationCaution: This command changes the system. Understand what it does before you run it.
ssh webuser@server.example.com 'bash -s' < ./check.shPasses the local script file as standard input to a Bash on the server, which executes it line by line. No file is left behind on the server. Arguments can be appended after bash -s, for example 'bash -s' -- arg1.
Note: The risk depends entirely on the script. Interactive commands do not work this way because standard input is already in use.
Also searched as
- run local script on remote server ssh
- ssh bash -s script
- execute script remotely without copying