通过隧道连接(通过ssh)连接jupyter python

时间:2018-11-23 13:56:59

标签: python jupyter-notebook jupyter

我无法连接到在远程计算机上运行的jupyter。我已使用ssl配置了jupyter,如以下文档所示:

https://jupyter-notebook.readthedocs.io/en/latest/public_server.html#hashed-pw

然后,按照教程中的命令:jupyter notebook在远程计算机上运行jupyter。 当它运行时,我通过运行以下命令在另一个终端中建立隧道:

ssh -N -f -L 8889:127.0.0.1:8881 user_name@hostname.com

当然,jupyter在port 8881上运行。当我在本地计算机上打开浏览器并尝试打开页面时:

localhost:8889

我收到一条错误消息,指出连接已重置,并且在命令行中ssh返回以下错误:

channel 2: open failed: connect failed: Connection refused

有人可以帮助我吗?我一直在寻找一整天的答案,但仍然无法解决。

1 个答案:

答案 0 :(得分:0)

问题是,就我而言,jupyter在本地主机上运行。在我的服务器远程服务器上,我无法访问远程本地主机,因此解决方案非常简单-我在指定的ip = 0.0.0.0上运行jupyter

jupyter notebook --no-browser --port=8881 --ip=0.0.0.0