# How to work with Jupyter Notebook on a remote machine (Linux)

I typically use my computers at home to connect to my work computer. I setup xRDP to remote desktop into my work computer(Linux) which is OK but slow at times depending on the Internet connection. Since I usually use jypyter notebook, I wanted to be able to run a jupyter notebook server on my work computer and access it from my home computer browser. I did some search on the Internet and found a method that works, thought I’d share it here.

1 - Open an SSH tunnel that forwards the port setup for Jupyter Notebook on the remote machine to a port on the local machine so that we can access it using our local browser

```
hamid@local_host$ ssh user@remote_host

user@remote_host$ jupyter notebook --no-browser --port=8889
```

This runs a jupyter notebook server on the remote machine on port:8889 without opening a browser since we will use the browser on our local machine to connect to this.

2- In a new terminal window on your local machine, SSH into the remote machine again using the following options to setup port forwarding.

```
hamid@local_host$ ssh -N -L localhost:8888:localhost:8889 user@remote_host
```

-N options tells SSH that no commands will be run and it’s useful for port forwarding, and -L lists the port forwarding configuration that we setup.

3- Access the remote jupyter server via your local browser. Open your browser and go to:

```
localhost:8888
```

To close the SSH tunnel simply do ctrl-c.


---

# 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://stephanosterburg.gitbook.io/scrapbook/data-science/fast.ai/how-to-work-with-jupyter-notebook-on-a-remote-machine-linux.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.
