How to change a password for Jupyter notebook

(Alexey Iskrov) #1

Hi! I’ve spent quite a lot of time trying to solve this simple issue, so I hope somebody here can help me.

I need to change a password from a default ‘dl_course’ to something else. I’ve tried several times to use a procedure described in many places on Internet. I used a notebook to create sha1 hash with the following code:

from notebook.auth import passwd
passwd()

I put a result in the config file at /home/ubuntu/.jupyter/jupyter_notebook_config.py something like this:

c.NotebookApp.password = u’sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed’

I know that this config file is being used because I have other parameters such as a path to certificate file and a port number and they work just fine. I start Jupyter with sudo like this:

sudo /home/ubuntu/anaconda2/bin/jupyter notebook --no-browser --config=/home/ubuntu/.jupyter/jupyter_notebook_config.py &

I need to do this because I have to use port 443 with SSL to access it from behind a firewall.

Anyway, it’s probably not a problem because as I said other parameter from the config are working just fine.

Basically, I need to find out where the default password is defined since it wasn’t set in jupyter_notebook_config.py initially and it seems like it overrides my own password definition.

Please help. Thanks!

Alexey

0 Likes

(Michael Ribbons) #2

Hi @alexey,
I used these same steps and it worked, although I don’t bother with the --config option as the path you show seems to be the default.

Care to post a sample password and hash?

If you are using the Amazon AMI builds then you should see that this field is populated, you can find the default password in the setup video I believe. (http://course.fast.ai/lessons/aws.html)

0 Likes

(Alexey Iskrov) #3

Hi @mribbons
Here is a line from my /home/ubuntu/.jupyter/jupyter_notebook_config.py

c.NotebookApp.password = u’sha1:552878d36e26:f50c11ad17aaf57f0cf2c42df8038df0471f0c9b’

This is a hash for a new password ‘to_test’ that I’ve just setup to try it again. Jupyter completely ignores it and I’m forced to use ‘dl_course’ to login. Again, i’m pretty sure that I’m using this configuration file because other parameters such as c.NotebookApp.port = 443 are working just fine.

Thank you for replying,

Alexey

0 Likes

(Michael Ribbons) #4

Hi @alexey,
My guess is that you still have the original

c.NotebookApp.password = ...

line at the end of the file.

1 Like

(Alexey Iskrov) #5

@mribbons You are absolutely right! It was still at the end of the file. I used the entry in the middle of the file and didn’t see that all parameters were defined at the end. Such a lame mistake :smile:
Thank you once again! I really appreciate your help.

0 Likes

(Michael Ribbons) #6

You are welcome @alexey. We all make these mistakes :wink:

0 Likes

(Seun ) #7

I have reading the instructions provided to secure a jupyter notebook server, but I am having some difficulties implementing these instructions.
When I attempt to create a password this is what I see: image
When should I enter the function [notebook.auth.security.passwd()] so that I can create a hashed password that looks something like ‘sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed’?

0 Likes