Password protect a SPECIFIC Jupyter notebook

Question:

The docs describe how to create a password to protect your jupyter notebooks. I would like to be able to create and share a particular notebook with a special password for just that notebook. Is this possible?

Asked By: abalter

||

Answers:

No, it is not possible. The password protects the whole Jupyter server. Once somebody has logged into the server, there’s nothing that could stop them from accessing all of the notebooks stored in the file system.

Answered By: Roland Weber

I needed to share password prtected notebook recently and after some research I found 3 ways to do it (and even wrote an article on how to share password protected Jupyter notebook).

First two options are for static notebook (converted to HTML) and third option is for sharing interactive notebook.

1. Use hosting platforms

There are hosting platforms like Vercel or Netlify that can add password protection to static website. You need to convert notebook to HTML file, change the name to index.html and upload to such hosting provider. It might require paid plan.

2. Encrypt notebook

There is a staticrypt library that can encrypt HTML file with your password.

  1. Convert Jupyter Notebook to HTML file.
  2. Use staticrypt website to generate encrypted HTML.
  3. Download encrypted HTML file.

You can share encrypted HTML file on GitHub Pages or AWS S3. You will have one password for all users.

3. Mercury

There is an open-source framework Mercury that can convert Jupyter Notebook to interactive web application. It is using YAML header to add widgets to the notebook. The YAML header has a share option, that can be used to specify with whom notebook is shared (you can read more in Mercury’s documentation).

Example YAML header:

title: Some title
description: Some app description
share: private
params:
    input: text
    label: Please enter text

Authentication is a paid feature in Mercury, so you will need a commercial license for this.

Answered By: pplonski