Jupyter notebooks for your team.

Try free
← Blog

Jupyter Notebook on a Remote Server: SSH Tunnel, Safe Remote Access and Keeping It Running, Tested (2026)

Run Jupyter on a server and use it from your laptop: jupyter lab --no-browser --port 8888 on the server, ssh -N -L 8890:localhost:8888 on the laptop. We ran the whole chain on 1 December 2026 with JupyterLab 4.6.6 and Windows 11's ssh, and cover tmux and systemd, what Jupyter's docs require before you open a port, VS Code, and what a 2 to 4 GB cloud VM costs: $12 to $36 a month.

Fastero Dev TeamFastero Dev Team2026-12-01Last updated: 2026-12-02

We ran the SSH-tunnel setup end to end on 1 December 2026. The "server" was a Debian container on our laptop with an SSH server and JupyterLab 4.6.6 in it; the client was Windows 11's built-in ssh; curl checked what every port answered before and after. We also started Jupyter Server on Windows to record its startup log, tried the settings Jupyter's security docs warn about, and priced small VMs on AWS, Lightsail and DigitalOcean.

The short answer: on the server, run jupyter lab --no-browser --port 8888, inside tmux so it survives logging out. On your laptop, run ssh -N -L 8890:localhost:8888 you@server, then open the http://localhost:8888/lab?token=... address the server printed with the port changed to 8890. Jupyter listens only on the server's own localhost by default, so the only port the server needs open is SSH's port 22. Open Jupyter's port to the network only if you can't use SSH, and then set a password and HTTPS first, as Jupyter Server's docs say. A cloud VM with 2 GB of memory costs about $12 to $21 a month. Checked 1 December 2026.

Fastero

Jupyter notebooks for your team, with nothing to install.

Start a notebook or bring your .ipynb files. SQL cells query your databases with no password in the code, and a notebook runs now or on a schedule. Colleagues open it with their own login; viewers are free.

Try free →

How to run Jupyter Notebook on a remote server

  1. Install Jupyter on the server, in a virtual environment:

    python3 -m venv ~/venv            # on Debian or Ubuntu: sudo apt install python3-venv first
    ~/venv/bin/pip install jupyterlab
  2. Start it without a browser. There's no screen on the server, so tell Jupyter not to open one:

    ~/venv/bin/jupyter lab --no-browser --port 8888

    It prints two addresses with a token, http://localhost:8888/lab?token=... and the same with 127.0.0.1. Jupyter Server's docs say it "runs locally at 127.0.0.1:8888 and is accessible only from localhost" unless you change --ip, so nobody on the internet can reach it yet, and neither can you.

  3. Open the tunnel from your laptop. In PowerShell, Terminal or any shell with OpenSSH:

    ssh -N -L 8890:localhost:8888 you@server

    -L 8890:localhost:8888 means: listen on port 8890 on this laptop, and send whatever arrives through the SSH connection to localhost:8888 as the server sees it. OpenSSH's manual puts -N as "Do not execute a remote command. This is useful for just forwarding ports." The command prints nothing and keeps running; that's the tunnel.

  4. Open the notebook. Paste the server's token address into your browser with 8888 changed to 8890: http://localhost:8890/lab?token=.... Lost the token? Run ~/venv/bin/jupyter server list on the server.

  5. Close it. Ctrl+C in the ssh window ends the tunnel. Jupyter keeps running if you started it in tmux (below); otherwise it stops when you log out.

Use a different local port, such as 8890, when you run Jupyter on the laptop too, so the two don't collide. And if the server's SSH runs on another port or needs a key, add -p 2222 or -i key.pem as usual.

Jupyter SSH tunnel: what we saw at each port

Diagram of the SSH tunnel: on the laptop, the browser opens localhost:8890 and the ssh client listens on 127.0.0.1:8890; one encrypted SSH connection crosses the internet to port 22 on the server, where sshd forwards it to JupyterLab listening on 127.0.0.1:8888 inside tmux; a direct request to server:8888 from the internet is refused because only port 22 is open

The setup in this post: the browser talks to the laptop's port 8890, SSH carries it to port 22, and JupyterLab on 8888 is reachable only from the server itself.

Our stand-in server listened for SSH on port 2222 of the laptop's loopback address, so our ssh commands carried -p 2222. We started JupyterLab in a detached tmux session with one ssh command, which then logged out, and checked from a fresh login:

$ ssh demo@server "tmux ls; ss -ltn | grep 8888; jupyter server list"
jupyter: 1 windows (created Mon Nov 30 23:28:40 2026)
LISTEN 0      128        127.0.0.1:8888      0.0.0.0:*
LISTEN 0      128            [::1]:8888         [::]:*
Currently running servers:
http://localhost:8888/?token=<redacted> :: /home/demo

Then the tunnel, from Windows 11's OpenSSH 9.5 to OpenSSH 10.0 on the server, and curl on the laptop:

Request from the laptop Answer
localhost:8890/api/status with no token 403
The same with ?token= 200, with the server's status as JSON
localhost:8890/lab?token= 200, the JupyterLab page
Any of them after Ctrl+C on the tunnel Connection refused (curl exit code 7)

After the tunnel closed, tmux ls on the server still showed the session. The server's log recorded our token-less request as 403 GET /api/status (@::1): to Jupyter, a visitor through the tunnel arrives from the server's own localhost. That's why the tunnel needs no Jupyter settings changed at all.

Jupyter on Windows behaves the same way. jupyter server --no-browser --port 8890 from a fresh venv (Jupyter Server 2.21.1) printed:

[I 2026-12-01 01:25:08.618 ServerApp] Jupyter Server 2.21.1 is running at:
[I 2026-12-01 01:25:08.618 ServerApp] http://localhost:8890/?token=<redacted>
[I 2026-12-01 01:25:08.618 ServerApp]     http://127.0.0.1:8890/?token=<redacted>
[I 2026-12-01 01:25:08.618 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

netstat showed it listening on 127.0.0.1:8890 and [::1]:8890 only, and a request to the laptop's own network address failed to connect.

Two things went wrong on the way, both worth knowing:

  • Windows refused our private key. Windows' ssh ignores a key file other accounts can read: WARNING: UNPROTECTED PRIVATE KEY FILE!, then Permission denied (publickey). Ours had inherited an extra entry from its folder. This fixed it, in PowerShell:

    icacls .\my_key /inheritance:r /grant:r "${env:USERNAME}:R"
  • A busy port moves Jupyter. With 8888 already taken by a forgotten server, a second jupyter lab --port 8888 printed "The port 8888 is already in use, trying another port." and started on 8889, where a tunnel to 8888 would never find it. Jupyter tries 50 more ports by default. Add --ServerApp.port_retries=0 to make it fail instead:

    ERROR: the Jupyter server could not be started because port 8888 is not available.

Keep Jupyter running after you log out: tmux or systemd

A Jupyter started in a plain SSH session dies when that session ends. Two fixes, depending on how long it has to live.

tmux, for a session you'll come back to. The tmux wiki describes detaching as "leaving the tmux session and any programs inside it running in the background".

tmux new -s jupyter                    # opens a terminal inside tmux
~/venv/bin/jupyter lab --no-browser --port 8888
# press Ctrl-b, then d, to detach; log out
tmux attach -t jupyter                 # later, from a new login

Or start it detached in one go, as we did, and log out straight away:

tmux new -d -s jupyter "~/venv/bin/jupyter lab --no-browser --port 8888"

tmux doesn't survive a reboot.

systemd, for a server that should always have Jupyter. Save this as /etc/systemd/system/jupyter.service, with your user name and paths:

[Unit]
Description=JupyterLab
After=network.target
 
[Service]
User=ubuntu
WorkingDirectory=/home/ubuntu/notebooks
ExecStart=/home/ubuntu/venv/bin/jupyter lab --no-browser --port 8888
Restart=on-failure
 
[Install]
WantedBy=multi-user.target

Then sudo systemctl daemon-reload and sudo systemctl enable --now jupyter. Each restart makes a new token, which journalctl -u jupyter shows, so a password (next section) is less hassle here. We didn't run this unit: our stand-in server was a container without systemd.

Access Jupyter Notebook remotely without a tunnel, safely

Sometimes SSH isn't an option: a colleague without a login, a phone, a tablet. Jupyter Server's docs cover running "a public server with a single user", and they are blunt about the stakes: "Since access to the Jupyter Server means access to running arbitrary code, it is important to restrict access to the server." The same page says this "should only be done by someone who wants remote access to their personal machine", and that "If you want a multi-user server, the official solution is JupyterHub." Our JupyterHub hosting guide covers that route.

If you go ahead, do all four:

  1. A password. jupyter server password asks for one and stores only its hash. When we did the same through Jupyter's own function, it wrote this to jupyter_server_config.json, and the server's address then carried no token:

    {
      "IdentityProvider": {
        "hashed_password": "argon2:$argon2id$v=19$m=10240,t=10,p=8$..."
      }
    }

    That matches the docs: "If you enable a password for your server, token authentication is not enabled by default." Their example config still sets c.ServerApp.password, which version 2.21.1's own help marks as deprecated:

    DEPRECATED in 2.0. Use PasswordIdentityProvider.hashed_password
  2. HTTPS. "When using a password, it is a good idea to also use SSL with a web certificate, so that your hashed password is not sent unencrypted by your browser." Pass --certfile and --keyfile, for example from Let's Encrypt, and use https:// from then on.

  3. Listen on the network. --ip 0.0.0.0 (or c.ServerApp.ip = '*' in the config file), with a fixed --port.

  4. A firewall that admits only you. Open the Jupyter port to your own IP address, not to everyone.

Don't expect Jupyter to warn you about a mistake. In our container, jupyter server --ip 0.0.0.0 with its default token printed no warning at all. With the token switched off as well, it printed one line, "All authentication is disabled. Anyone who can connect to this server will be able to run code.". The security docs call that setup "NOT RECOMMENDED, unless authentication or access restrictions are handled at a different layer in your web application".

Jupyter notebooks for your team.

Start free →

Jupyter notebook on AWS EC2

The tunnel works on EC2 unchanged; the AWS-specific parts are the firewall and the address:

  1. Launch an instance from an Ubuntu image, with a key pair you download as a .pem file.

  2. Inbound rules: allow SSH, port 22, only from what AWS's rules page calls "The public IPv4 address of your computer, or a range of IP addresses in your local network". Add no rule for 8888.

  3. Install and start Jupyter as above, then open the tunnel with the key and the instance's public DNS name:

    ssh -i key.pem -N -L 8890:localhost:8888 ubuntu@<public DNS>
  4. Stop the instance when you're done for the day; it stops charging for compute, though its disk still costs.

With AWS Systems Manager set up (its agent on the instance, the Session Manager plugin on your laptop), you can skip port 22 entirely: AWS describes Session Manager as working "without the need to open inbound ports". Its documented form for forwarding a port:

aws ssm start-session --target i-0123456789abcdef0 \
  --document-name AWS-StartPortForwardingSession \
  --parameters '{"portNumber":["8888"], "localPortNumber":["8890"]}'

What a small cloud VM for Jupyter costs

Prices read on 1 December 2026; EC2 is US East, Linux, on demand. We added each EC2 line's public IPv4 address ($0.005 an hour) and a 20 GB gp3 disk at $0.08 per GB-month, the rate AWS's own example uses. Lightsail and DigitalOcean prices already include a disk and an IPv4 address.

Machine vCPU, memory Per hour Always on, a month 8 h × 22 days
Lightsail 2 GB plan 2, 2 GB $12.00
DigitalOcean Basic, 2 GiB 1, 2 GiB $0.01786 $12.00
EC2 t4g.small (Arm) 2, 2 GiB $0.0168 $17.51 $8.21
EC2 t3.small 2, 2 GiB $0.0208 $20.43 $8.91
Lightsail 4 GB plan 2, 4 GB $24.00
DigitalOcean Basic, 4 GiB 2, 4 GiB $0.03571 $24.00
EC2 t3.medium 2, 4 GiB $0.0416 $35.62 $12.57
EC2 t3.large 2, 8 GiB $0.0832 $65.99 $19.89
EC2 g4dn.xlarge (GPU) 4, 16 GiB $0.526 $389.23 $97.83

The last column assumes the instance is stopped outside working hours: compute stops, but we kept the disk and the address for the whole month, since AWS charges an idle public IPv4 address at the same $0.005 an hour. We computed both columns from AWS's published rates with a short script. Three notes:

  • 2 GB is the floor for comfort. VS Code's Remote-SSH docs say "1 GB RAM is required for remote hosts, but at least 2 GB RAM and a 2-core CPU is recommended", and a notebook that holds a large DataFrame in memory needs more.
  • The GPU line is for training. "G4dn instances feature NVIDIA T4 GPUs", AWS says; at $0.526 an hour, a free Kaggle GPU or Colab session is worth trying first.
  • Credits and billing. AWS's pricing pages say new customers get up to $200 in Free Tier credits, and DigitalOcean says "Effective January 1, 2026, we're moving to per-second billing" for Droplets.

VS Code: connect to a remote Jupyter kernel

Two ways, and the first is usually simpler:

  • Remote-SSH. Install the Remote-SSH extension, run Remote-SSH: Connect to Host... with the same user@hostname you'd give ssh, and open a folder on the server. Notebooks then run on the server's Python, and you don't need a Jupyter server or a tunnel: VS Code's docs say "Only the IPyKernel package is required to launch a Python process as a kernel and execute code against your notebook" (pip install ipykernel on the server). Its Ports view can also forward a port for you, in place of ssh -L.
  • Existing Jupyter Server. With the tunnel open, choose Select Kernel › Select Another Kernel › Existing Jupyter Server and paste http://localhost:8890/?token=.... VS Code's page also tells you to start the server allowing all origins and listening on all IPs, using the older NotebookApp names for ServerApp.allow_origin and ServerApp.ip. On a tunnel the second isn't needed, since the server only has to answer its own localhost. Never combine those two settings with an open port and no password. We didn't test VS Code's connection itself.

More on the editor itself in Jupyter vs VS Code for data science.

When a hosted Jupyter notebook in the cloud is simpler

A server of your own means you patch it, size it, back up its disk, keep the token safe and stop it when idle. A hosted notebook is less work when:

  • You need a free GPU: Kaggle gives about 30 GPU hours a week; Colab has a T4 when one is free.
  • You just want Jupyter in a browser: twelve places to run a notebook online, several free and with nothing to install.
  • Your team needs it: a hub with logins for everyone, which is JupyterHub or a workspace that replaces it.
  • The work already lives in a code repository: GitHub Codespaces opens it with JupyterLab or VS Code.

Where Fastero fits

Fastero is an AI and data platform where people and AI agents work together on a team's data, and its notebooks run on a server nobody on the team has to set up. Each workspace gets its own notebook server, JupyterHub on Kubernetes, with Fastero's own editor behind the team's login, so there's no tunnel, token or open port to manage:

  • Your .ipynb files, uploaded or imported from the project's Git repository, on Python 3.11 with pandas, SQLAlchemy and seaborn.
  • Cron schedules that run a notebook on the server with no browser open, and Secrets that reach cells as environment variables, in scheduled runs too.
  • SQL cells that query a saved connection (Postgres, MySQL, SQL Server, Redshift, Oracle or BigQuery) and hand back a pandas DataFrame named after the cell.
  • Colleagues sign in to read; the Viewer role reads but can't run or save, and viewers are free.

Each workspace server has 1 CPU and 2 GB as standard (on Pro, bigger machines up to 8 CPUs and 32 GB, charged by the hour). The interactive server stops after about 10 idle minutes; a scheduled run doesn't need you there. The Free plan includes 6 hours a day of notebook and Python run time and $20 of AI usage, with no card; Pro is $20 per editor a month (pricing).

The schedule dialog of a notebook in Fastero, with quick presets and a cron expression set to run daily at 7:00 AM

Scheduling a notebook in Fastero: presets or any cron expression. Sample data.

FAQ

How do I access a Jupyter notebook running on a remote server?

Start it on the server with jupyter lab --no-browser --port 8888, then run ssh -N -L 8890:localhost:8888 you@server on your laptop and open http://localhost:8890/lab?token=... with the token the server printed. Nothing but SSH needs to be open on the server.

Why does my remote Jupyter say 403 Forbidden?

The request carried no token or login. Use the full address with ?token=, which jupyter server list prints on the server, or set a password. In our test the same request returned 403 without the token and 200 with it.

Is it safe to run Jupyter with --ip 0.0.0.0?

Only with a password, HTTPS and a firewall limited to your own address, because anyone who gets past its login can run code as your user. Jupyter printed no warning when we bound it to 0.0.0.0. An SSH tunnel avoids the question, since Jupyter stays on localhost.

How do I keep Jupyter running after I close SSH?

Start it inside tmux (tmux new -s jupyter, then Ctrl-b d to detach) and reattach later with tmux attach -t jupyter. For a server that reboots, run it as a systemd service with Restart=on-failure.

How much does it cost to run Jupyter on AWS EC2?

A t3.small with 2 GiB costs $0.0208 an hour, about $20.43 a month always on once a public IPv4 address and a 20 GB disk are added, or about $8.91 if it runs 8 hours on 22 days. Lightsail's 2 GB plan is $12 a month with the disk and address included.

Can VS Code connect to a remote Jupyter server?

Yes. Remote-SSH runs notebooks on the server's Python with only ipykernel installed, and the kernel picker's Existing Jupyter Server option connects to any Jupyter URL, including http://localhost:8890/?token=... through an SSH tunnel.

Sources

Read on 1 December 2026; our runs used JupyterLab 4.6.6 and Jupyter Server 2.21.1.


Try Fastero free: a notebook server for your team that nobody has to run, with schedules, secrets and your colleagues' own logins. No credit card required.

Start a notebook next to your team's data.

Python 3.11 with pandas, SQLAlchemy and seaborn, SQL cells on your databases, and scheduled runs on the Free plan. No credit card required.

Follow Fastero on LinkedIn for new articles and examples.