Secure Setup for Using Jupyter Notebook on NAS Systems

Article ID: 622
Last updated: 18 Dec, 2025

The typical Jupyter installation includes more than 125 packages. If any one of these packages has been compromised, any account running Jupyter could become compromised. Keep in mind that even if the initial installation does not include any compromised packages, you might need to install additional packages—which could have been compromised. Or, you might run a Jupyter "notebook," obtained from an internet repository, that contains hidden malware; a Jupyter notebook has exactly the same access to files and other system resources as the user who started the notebook server. While we do not know of any active exploits against Jupyter at this time, this is a serious risk.

WARNING: We recommend you do not use Jupyter, or similar software, if your account has access to any ITAR, proprietary, or non-public data or programs.

Steps for Securely Setting Up Jupyter Notebook

Before you use Jupyter Notebook on NAS systems, you must complete these steps.

Notes:

  • You only need to do these steps once (the first time you use Jupyter).
  • Some of the command lines are too long to be formatted as one line, so they are broken with a backslash (\).

Before You Begin: Make sure you have set up SSH passthrough.

  1. Log into a PFE and load the miniconda3 module from the /swbuild/analytix directory:
    pfe20% module use -a /swbuild/analytix/tools/modulefiles
    pfe20% module load miniconda3/v4
  2. To access Jupyter commands, activate a conda environment with Jupyter installed. All provided environments other than the base environment will work. For a list of other environments you can use, see Machine Learning: Overview. We suggest using the latest tensorflow or pytorch environment. In this example, we use the jupyterlab environment:
    (For bash) pfe20% source activate jupyterlab
    (For csh) pfe20% source /swbuild/analytix/tools/miniconda3_220407/bin/activate.csh jupyterlab
  3. Set a password for your Jupyter notebooks, using both the jupyter notebook and the jupyter server commands:
    (jupyterlab)% jupyter notebook password
    (jupyterlab)% jupyter server password

    Two JSON password files will be written to your $HOME/.jupyter directory. Both commands are needed to ensure that the secure setup is compatible with older environments. In the future, Jupyter will move to using only jupyter server commands, so using both commands will also help guarantee future compatibility. The password used for both commands should be the same to reduce troubleshooting steps, but make sure the password follows the same security standards as other NAS passwords..

    Note: The default "token" authentication is not as secure as a password if you plan to share the notebook with others.

  4. Make the Jupyter configuration information visible only to you:
    (jupyterlab)% chmod 700 $HOME/.jupyter
  5. Protect Jupyter from request forgery by creating a self-signed certificate for your Jupyter HTTPS server:
    (jupyterlab)% openssl req -x509 -config \
    /swbuild/analytix/tools/jupyter_setup/jupyter_ssl.conf \
    -newkey rsa -out $HOME/.jupyter/jupyter.pem -days 1000
  6. Copy the default NAS configuration files to your private configuration directory. These configuration files allow you to connect to the Jupyter server from your local web browser. The following command line copies two different configuration files (jupyter_server_config.py and jupyter_notebook_config.py) to your .jupyter directory:
    (jupyterlab)% cp /swbuild/analytix/tools/jupyter_setup/jupyter_*_config.py \
    $HOME/.jupyter/
  7. Verify that the following files are present in your $HOME/.jupyter directory:
    (jupyterlab)% ls -l $HOME/.jupyter/
    -rw------- 1    103 Jun 17 14:35 jupyter_notebook_config.json
    -rw------- 1    103 Jun 17 14:35 jupyter_server_config.json
    -rw------- 1   1704 Jun 17 14:35 jupyter.key
    -rw------- 1   1155 Jun 17 14:35 jupyter.pem
    -rw------- 1  29875 Jun 17 14:35 jupyter_notebook_config.py
    -rw------- 1  57082 Jun 17 14:35 jupyter_server_config.py
    

    There might be additional files in the directory, but it must contain at least the six listed here.

  8. Deactivate the environment:
    (jupyterlab)% conda deactivate

The setup is done. To clear any environment variables, log out of the PFE and log back in. You can now use Jupyter Notebook by following the instructions in Using Jupyter Notebook for Machine Learning Development.

IMPORTANT: You must run Jupyter on a node dedicated to you alone. You can do this either by running an interactive PBS session (for CPU or GPU jobs) or by reserving a dedicated compute node (for CPU jobs only). Running Jupyter on any other system, including an secure front end (SFE), Lou front end (LFE), or a non-dedicated front-end system, is prohibited.
Also read

Contact Us

General User Assistance

Security

  • Report security issues 24x7x365
  • Toll-free: 1-877-NASA-SEC (1-877-627-2732)
  • E-mail: soc@nasa.gov

User Documentation

High-End Computing Capability (HECC) Portfolio Office

NASA High-End Computing Program

Tell Us About It

Our goal is furnish all the information you need to efficiently and effectively use the HECC resources needed for your NASA computational projects.

We welcome your input on features and topics that you would like to see included on this website.

Please send us email with your wish list and other feedback.