![ssh tunnel jupyter notebook ssh tunnel jupyter notebook](http://www.wzhecnu.cn/img/alipay.jpg)
Is your db server really listening on port 3306 or possibly on port 1081? If the latter is true, then your command should be changed to look like this: ssh -L 1081:localhost:1081 remotehost And it is not forwarding to port 1081 but to 3306. But the netstat command on your remotehost can’t find anything listening at 1081 (at least not as a result of the tunnel).īecause the pink port isn’t a listening port created by ssh, but the target of the forwarding. Now your php scripts can access your database via localhost:1081. If you do ssh -L 1081:localhost:3306 remotehostĪll connection attempts to the green port 1081 are forwarded through the ssh tunnel to the pink port 3306 on the remotehost’s localhost, i.e. -T disables pseudo-tty allocation, which is appropriate because you're not trying to create an interactive shell.If all you're creating is a tunnel, then including this option saves resources. -N says that you want an SSH connection, but you don't actually want to run any remote commands.
![ssh tunnel jupyter notebook ssh tunnel jupyter notebook](https://radcamp.github.io/AF-Biota/Jupyter_Notebook_Setup_files/Jupyter_Notebook_tunnel_diagram2.png)
Luckily, ssh provides the -L option to specify port forwarding. Hence, the basic idea would be to make that port reachable from your host machine. Remote: -R Specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side. Jupyter Notebook runs on a certain port on the machine. Ssh -L sourcePort:forwardToHost:onPort connectToHost means: connect with ssh to connectToHost, and forward all connection attempts to the local sourcePort to port onPort on the machine called forwardToHost, which can be reached from the connectToHost machine. Local: -L Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side. The machine, where the ssh tunnel command is typed is called »your host«.