> For the complete documentation index, see [llms.txt](https://til.devjugal.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.devjugal.com/linux/ssh/run-a-local-script-on-remote-ssh-server.md).

# Run A Local Script On Remote SSH Server

Typically on SSH connection, we run commands on the remote server, but in order to run a local script on the remote server we can use `bash -s` which expects input from standard input, and runs the script in shell session.

## Example

```bash
ssh user@remotehost 'bash -s' < script.sh
```

***Source:*** [***Cloudsavvyit***](https://www.cloudsavvyit.com/14216/how-to-run-a-local-shell-script-on-a-remote-ssh-server/)
