5

Trying to connect to a Jupyter Notebook through SSH.

I have a script which logs in to machine through SSH:

#!/usr/bin/expect -f
spawn ssh -L localhost:4000:localhost:8889 user@sshaddress.com
expect "assword:"
send "password\r"
interact

Set the jupyter password:

jupyter notebook password
# set it to something

Then I run jupyter:

jupyter notebook --no-browser --port=8889

Then I open my localhost:4000 and get the jupyter login page.

However, putting in the password here only gives 'Invalid credentials'.

Why would this be?

Colin Ricardo
  • 16,488
  • 11
  • 47
  • 80
  • Should `expect "assword:"` be `expect "password:"`? – asherbret Sep 24 '18 at 20:19
  • No. See [here](https://stackoverflow.com/questions/16928004/how-to-enter-ssh-password-using-bash). Also, that's not related to the Jupyter stuff that's just for logging into the server with SSH. – Colin Ricardo Sep 24 '18 at 20:28

1 Answers1

1

I have a similar problem, but I'm not sure if it's identical. I have two servers where I run notebooks which I access through SSH tunneling. Whether or not my password works depends on whether I use localhost or 127.0.0.1 in the URL. I cannot figure out why.

Case 1: Run browser on the server

  • both localhost and 127.0.0.1 accept my password

Case 2: SSH to server 1

  • localhost accepts my password
  • 127.0.0.1 rejects my password

Case 3: SSH to server 2

  • localhost rejects my password
  • 127.0.0.1 accepts my password

If you access the server using 127.0.0.1:4000, does that work?

gauss256
  • 2,603
  • 4
  • 23
  • 23