SaferComputing.com

Reference · Local AI servers

Jupyter port 8888: check the token, password and ip setting

Check whether JupyterLab or Notebook on port 8888 listens on 0.0.0.0, find every running server and its token with jupyter server list, set a password, and see what turning the token off does.

Published
Last checked
Applies to
JupyterLab 4, Jupyter Notebook 7 and Jupyter Server 2 on Windows 11, macOS and Linux, including Docker
Technical specification
Target artifactThe Jupyter Server that runs JupyterLab and Notebook 7, on TCP port 8888, with its address set by --ip or c.ServerApp.ip and its sign-in by a token or a password.
Default behaviourListens on 127.0.0.1:8888, this computer only, and requires a random token that it prints in the terminal inside a sign-in URL. If 8888 is taken, it tries up to 50 more ports. Setting a password turns the token off.
Safe stateListening on 127.0.0.1 or localhost only; a token or a password required; no empty token setting; no --ip=0.0.0.0 or c.ServerApp.ip = '*' on a computer other devices can reach; sign-in URLs kept as private as a password.
Check in Jupyterjupyter server list
Check on Linuxsudo ss -tlnp | grep -E ':88[0-9][0-9]\b'
Check on WindowsGet-NetTCPConnection -State Listen -LocalPort 8888, 8889, 8890 -ErrorAction SilentlyContinue | Select-Object LocalAddress, LocalPort, OwningProcess
Check on macOSsudo lsof -nP -iTCP -sTCP:LISTEN | grep -E ':88[0-9][0-9] '
Check from another devicecurl --max-time 5 -I http://SERVER_IP:8888/
Fixstart it with --ip=127.0.0.1, or set c.ServerApp.ip = 'localhost' in jupyter_server_config.py
Fix for sign-injupyter server password
Fix in Dockerpublish with -p 127.0.0.1:8888:8888, never -p 8888:8888

Read the result

jupyter server list prints the URL and folder of each running server, whether it was started as JupyterLab, Notebook 7 or plain Jupyter Server. Run it as the user who started Jupyter.

  • A URL ending in ?token=... means token sign-in is on. Anyone who has that URL can sign in with it, so treat it like a password.
  • A URL without a token means the server uses a password, or has authentication turned off. The configuration check below tells you which.
  • The port in the URL is the one to check: a second server moves to another port when 8888 is taken.

The socket checks show the address the server asked for:

Listening addressWho can reach Jupyter
127.0.0.1:8888 or [::1]:8888This computer only
0.0.0.0:8888, *:8888 or [::]:8888Every network interface: Wi-Fi, Ethernet and any VPN
A network address, such as 192.168.1.20:8888Anyone who can reach that network

From another device, any HTTP status line, even an error such as 405 Method Not Allowed, means the server answers from there. "Connection refused" or a timeout means it does not. In Windows PowerShell, type curl.exe rather than curl.

Why it matters

Jupyter Server's documentation puts it plainly: access to the server means access to running arbitrary code. That is why token sign-in is on by default. The token is what stops anyone who reaches the port from running code as you.

Keep it on 127.0.0.1

Command line, shortcuts and services

Jupyter listens on localhost unless its options say otherwise. Look for --ip=0.0.0.0 in the command you type, a shortcut, a script or a service definition, and remove it or replace it:

Terminal
jupyter lab --ip=127.0.0.1 --port=8888

The same options work with jupyter notebook and jupyter server. Stop a running server with Control-C in its terminal (twice to skip the confirmation), then start it again.

Configuration files

jupyter --paths lists the folders Jupyter reads configuration from. Your own settings are normally in the .jupyter folder in your home folder, in jupyter_server_config.py and jupyter_server_config.json. Where both set the same option, the .json file wins. List the settings that are not commented out:

Linux or macOS terminal
grep -nE '^[^#]*(\.ip|token|password)' ~/.jupyter/jupyter_*_config.*

On Windows, open the same files in C:\Users\USERNAME\.jupyter\ in a text editor.

  • c.ServerApp.ip = '0.0.0.0' or '*': listens on every interface. Change it to 'localhost', the default, or delete the line.
  • c.IdentityProvider.token = '', or the older c.ServerApp.token = '': token sign-in is off. See the warning below.
  • hashed_password: a password is set.
  • Settings named c.NotebookApp... in jupyter_notebook_config.py come from the classic Notebook server. Jupyter Server's migration guide says to rename them to c.ServerApp... in jupyter_server_config.py.
Docker

The Jupyter Docker Stacks documentation starts its images with -p 8888:8888, which publishes the port on every address of the host. Publish it on the loopback address instead:

Linux, as a user in the docker group
docker run -it -p 127.0.0.1:8888:8888 quay.io/jupyter/scipy-notebook:2026-07-28

Jupyter Server's own Docker example starts the server with --ip=0.0.0.0 inside the container; that is expected. What matters is the host side, which docker ps --format 'table {{.Names}}\t{{.Ports}}' shows. The sign-in URL is in the container's log, for example docker logs --tail 3 notebook for a container named notebook. Ports published by Docker bypass UFW; see Docker published ports.

Token and password

  • With no password set, Jupyter generates a new random token and prints it in the terminal inside the sign-in URL. After the first sign-in, a browser cookie keeps you signed in.
  • JUPYTER_TOKEN, or a file named in JUPYTER_TOKEN_FILE, sets a fixed token instead. If either is set, make sure the value is long and random.
  • jupyter server password asks for a password twice and writes an argon2 hash of it to jupyter_server_config.json. From then on the token is off by default, and jupyter server list shows the URL without one. Restart the server to apply it.
Terminal
jupyter server password

Stop An empty token turns sign-in off

c.IdentityProvider.token = '', or --IdentityProvider.token='' on the command line, with no password set, disables authentication altogether. Jupyter's documentation says this is not recommended unless authentication or access restrictions are handled at a different layer. On a server that listens on 0.0.0.0, it lets anyone who reaches the port run code on the computer.

Reach it from another computer

Forward the port over SSH instead of listening on the network:

Your laptop
ssh -N -L 8888:127.0.0.1:8888 USER@SERVER

While the tunnel runs, open the URL from jupyter server list on the laptop. Jupyter's guide to running a public server is meant only for someone who wants remote access to their own machine; it adds a password and HTTPS with --certfile and --keyfile.

Troubleshooting

It still listens on 0.0.0.0 after the change
  • The server was not restarted. Jupyter reads its options when it starts.
  • The .json configuration file sets the option, and it wins over the .py file.
  • A shortcut, script or service passes --ip=0.0.0.0 on the command line.
  • It runs in Docker: read the docker ps port column instead.
The port is 8889 or higher

When 8888 is taken, Jupyter tries up to 50 more ports; JUPYTER_PORT_RETRIES or c.ServerApp.port_retries changes that number. jupyter server list shows the port each server got. Repeat the socket check with that number.

The list shows a URL without a token

Either a password is set, or authentication is off. Run the configuration check above: a hashed_password line means a password; an empty token with no password means anyone who reaches the port can run code. Also check how the server was started, for an empty --IdentityProvider.token option.

Sources