无法使用 ssh 在 HPC 上远程启动 jupyter notebook
Cannot start jupyter notebook remotely on HPC using ssh
我使用以下方式登录到 HPC:
ssh -p 2222 user@hpc.edu
然后使用以下命令启动 Jupyter notebook:
jupyter notebook --no-browser --port=9999
我得到了一个 url:
http://localhost:9999/?token=0518475c55eaafb82abce7d2d5344b48174012
然后我尝试使用我的计算机远程访问 Jupyter notebook:
ssh -p 2222 user@hpc.edu -L 9999:localhost:9999 -N
长时间连接被拒绝:
channel 2: open failed: connect failed: Connection refused
我记得之前不放
就可以访问notebook
-p 2222
在任何地方的 ssh 命令中。但是现在我必须远程ssh。远程访问 jupyter notebook 是否需要任何其他命令更改?
编辑:
我在计算机上执行的命令中添加了 -v -v。内容如下:
password: debug2: input_userauth_info_req debug2: input_userauth_info_req: num_prompts 0 debug1: Authentication succeeded (keyboard-interactive). Authenticated to bridges.psc.edu ([128.182.108.57]:2222). debug1: Local connections to LOCALHOST:9999 forwarded to remote address localhost:9999 debug1: Local forwarding listening on ::1 port 9999. debug2: fd 4 setting O_NONBLOCK debug1: channel 0: new [port listener] debug1: Local forwarding listening on
127.0.0.1 port 9999. debug2: fd 5 setting O_NONBLOCK debug1: channel 1: new [port listener] debug2: fd 3 setting TCP_NODELAY debug1: Requesting no-more-sessions@openssh.com debug1: Entering interactive session. debug1: pledge: network debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1 debug1: Connection to port 9999 forwarding to localhost port 9999 requested. debug2: fd 6 setting TCP_NODELAY debug2: fd 6 setting O_NONBLOCK debug1: channel 2: new [direct-tcpip] channel 2: open failed: connect failed: Connection refused debug2: channel 2: zombie debug2: channel 2: garbage collecting debug1: channel 2: free: direct-tcpip: listening port 9999 for localhost port 9999, connect from 127.0.0.1 port 54542 to
127.0.0.1 port 9999, nchannels 3 debug1: Connection to port 9999 forwarding to localhost port 9999 requested. debug2: fd 6 setting TCP_NODELAY debug2: fd 6 setting O_NONBLOCK debug1: channel 2: new [direct-tcpip] channel 2: open failed: connect failed: Connection refused
这个适合我。首先,使用以下命令从您的服务器启动 Jupyter:
jupyter notebook --no-browser --port=7002
然后从您的本地计算机,您可以使用以下代码隧道连接到 Jupyter
ssh -N -f -L localhost:7001:localhost:7002 user@hpc.edu
现在您可以通过浏览 localhost:7001
从本地计算机访问 Jupyter
可以在此处找到更多详细信息:here
我使用以下方式登录到 HPC:
ssh -p 2222 user@hpc.edu
然后使用以下命令启动 Jupyter notebook:
jupyter notebook --no-browser --port=9999
我得到了一个 url:
http://localhost:9999/?token=0518475c55eaafb82abce7d2d5344b48174012
然后我尝试使用我的计算机远程访问 Jupyter notebook:
ssh -p 2222 user@hpc.edu -L 9999:localhost:9999 -N
长时间连接被拒绝:
channel 2: open failed: connect failed: Connection refused
我记得之前不放
就可以访问notebook-p 2222
在任何地方的 ssh 命令中。但是现在我必须远程ssh。远程访问 jupyter notebook 是否需要任何其他命令更改?
编辑:
我在计算机上执行的命令中添加了 -v -v。内容如下:
password: debug2: input_userauth_info_req debug2: input_userauth_info_req: num_prompts 0 debug1: Authentication succeeded (keyboard-interactive). Authenticated to bridges.psc.edu ([128.182.108.57]:2222). debug1: Local connections to LOCALHOST:9999 forwarded to remote address localhost:9999 debug1: Local forwarding listening on ::1 port 9999. debug2: fd 4 setting O_NONBLOCK debug1: channel 0: new [port listener] debug1: Local forwarding listening on
127.0.0.1 port 9999. debug2: fd 5 setting O_NONBLOCK debug1: channel 1: new [port listener] debug2: fd 3 setting TCP_NODELAY debug1: Requesting no-more-sessions@openssh.com debug1: Entering interactive session. debug1: pledge: network debug1: client_input_global_request: rtype keepalive@openssh.com want_reply 1 debug1: Connection to port 9999 forwarding to localhost port 9999 requested. debug2: fd 6 setting TCP_NODELAY debug2: fd 6 setting O_NONBLOCK debug1: channel 2: new [direct-tcpip] channel 2: open failed: connect failed: Connection refused debug2: channel 2: zombie debug2: channel 2: garbage collecting debug1: channel 2: free: direct-tcpip: listening port 9999 for localhost port 9999, connect from 127.0.0.1 port 54542 to
127.0.0.1 port 9999, nchannels 3 debug1: Connection to port 9999 forwarding to localhost port 9999 requested. debug2: fd 6 setting TCP_NODELAY debug2: fd 6 setting O_NONBLOCK debug1: channel 2: new [direct-tcpip] channel 2: open failed: connect failed: Connection refused
这个适合我。首先,使用以下命令从您的服务器启动 Jupyter:
jupyter notebook --no-browser --port=7002
然后从您的本地计算机,您可以使用以下代码隧道连接到 Jupyter
ssh -N -f -L localhost:7001:localhost:7002 user@hpc.edu
现在您可以通过浏览 localhost:7001
可以在此处找到更多详细信息:here