Skip to content

Debugging over SSH

Don Jayamanne edited this page Nov 3, 2016 · 2 revisions

Windows:

  • Firstable, the ssh portforwading must be enabled on server side (sshd_config or similar).
  • Putty SSH tunnel could be established using the following procedure:
    • http://realprogrammers.com/how_to/set_up_an_ssh_tunnel_with_putty.html (until Open the session section).
    • On the Tunnels screen, using a local mode, source port (which is the port which will be the entry point on the local computer) can be different from the destination port (the end point on the server).
    • Destination address should be the localhost or 127.0.0.1 address (which is the address that the remote ssh server will use to establish the tunnel).

On Linux/Mac:

  • ssh -L sourceport:localhost:destinationport user@remoteadresse

Visual Studio Code:

  • Once the tunnel is opened (and you are able to see a prompt in the ssh session), you have to configure the VSCode launch.json file to connect to localhost:sourceport (where source port should be replaced by the one you put in the Tunnels screen, which is the debug port).
  • Then on the server you should launch the python script using the python remote debug prior to use the VSCode remote debug using the "Attach (Remote Debug)" mode
Clone this wiki locally