PyCharm multi-hop ssh configuration
This is how I remotely access my personal workstation with GPUs:
Local computer (mac-mini) --> SSH --> Gate Server --> SSH --> Workstation
For example, to use Jupyter Notebook on my local computer, I use the following command in the terminal:
ssh -L 6000:127.0.0.1:6000 username@gate.server.address
And then type 127.0.0.1:6000 in the web browser.
This works because Jupyter Notebook is running on port 6000 on my workstation, and on the Gate Server, the port is forwarded as:
ssh -L 6000:127.0.0.1:6000 workstation
I tried using PyCharm for debugging in this situation.
I followed the steps as in: PyCharm: Configuring multi-hop remote Interpreters via SSH
-
opened a terminal in my local computer
ssh -L 6000:workstation:22 username@gate.server.address -
configure PyCharm
-
host: localhost
-
port: 6000
-
user: username
-
However, it was not connected to my workstation, presumably somewhere in the Gate Server, and failed to find where Python was installed on my workstation.
Therefore, I also changed my ./.ssh/config as follows:
Host workstation
HostName workstation
User username
ProxyCommand ssh -q -W %h:%p gate
KexAlgorithms +diffie-hellman-group1-sha1
Host gate
HostName gate.server.address
User username
IPQoS=throughput
KexAlgorithms +diffie-hellman-group1-sha1
And configure PyCharm:
-
host: workstation
-
port: 22
-
user: username
This time, the error message popped up that failed to connected to workstation:22.
Lastly, on the Gate Server, I tried portforwarding as follow:
ssh -L 22:127.0.0.1:2323 workstation
And it was denied becasue "privileged ports can only be forwarded by root".
So I couldn't try running this on my local computer:
ssh -L 6000:127.0.0.1:22 username@gate.server.address
My Questions are:
-
What is the best SSH tunneling set up/PyCharm configuration in this situation?
-
Using VPN is necessary?
- If none of solutions works, then do I have to use other Python IDE?
Please sign in to leave a comment.
You mentioned that accessing `http://127.0.0.1:6000` works in your browser on the local machine (where PyCharm is also running), is that right?
If so, have you tried connecting to this server using URL in PyCharm?
https://www.jetbrains.com/help/dataspell/creating-and-managing-projects.html#remote