MattLBeck
MattLBeck

Reputation: 5831

Why does Jupyter require an unknown password when hosted on a vagrant VM?

I am trying to set up a vagrant box with python and use Jupyter to run code from my browser on the host. Here is a minimal example:

Vagrantfile:

Vagrant.configure('2') do |config|
  config.vm.box      = 'ubuntu/trusty64'

  config.vm.network :forwarded_port, guest: 8888, host: 8888

  config.vm.provision "shell", inline: <<-SHELL
    apt-get install -y python-dev python-pip
    pip install jupyter
  SHELL
end

In my windows host cmd I execute these commands in the same directory as the Vagrantfile:

 > vagrant up
 > vagrant ssh
~$ jupyter notebook --no-browser --ip=0.0.0.0

I then navigate to localhost:8888 in Chrome on my windows host only to find a Jupyter login page asking for a password I have never set. I have tried entering no password and "vagrant" in case it was linked to the VM's password.

Why is Jupyter asking me for a password?

Upvotes: 0

Views: 2277

Answers (2)

David Maryakhin
David Maryakhin

Reputation: 31

There is also a way to completely disable jupyter authentication by setting NotebookApp.token to empty string in jupyter_notebook_config.py or when launching server with something like:

jupyter notebook --no-browser --ip=0.0.0.0 --NotebookApp.token=''

This inherently not secure and may be acceptable only for development purposes on your local environment.

Upvotes: 3

jaxim
jaxim

Reputation: 1115

This comment covers a recent change to Jupyter.

If you do:

jupyter notebook list

This will give you the token that you will need to then pass in:

http://localhost:8888/?token=yourToken

The token will also be outputted to the console when you start the notebook for the first time:

vagrant@vagrant-ubuntu-trusty-64:~$ jupyter notebook --no-browser --ip=0.0.0.0
Serving notebooks from local directory: /home/vagrant
0 active kernels
The Jupyter Notebook is running at: http://0.0.0.0:8888/?token=yourToken

Upvotes: 1

Related Questions