# 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/)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://til.devjugal.com/linux/ssh/run-a-local-script-on-remote-ssh-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
