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



我在连接到在远程计算机上运行的jupyter时遇到问题。我已经在以下文档中配置了带有ssl的jupyter:

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

然后,我在远程机器上运行jupyter,使用命令:jupyter notebook,如教程中所述。当它运行时,我通过运行命令在另一个终端中创建隧道:

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

有人能帮我吗?我一整天都在寻找答案,但仍然无法解决。

问题是,在我的案例中,jupyter运行在localhost上。在我的服务器远程服务器上,我无法访问远程本地主机,所以解决方案很简单——我在指定的ip=0.0.0.0 上运行jupyter

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

最新更新