It's common that your server(destination_server) is running in cloud(AWS) which you have to access via another linux server(proxy_server), and you want to enable remote debug in the destination_server.
To do this, run this in the proxy_server:
ssh -f -N -L9999:localhost:9999 username@destination_server
Run this in your local server:
ssh -f -N -L9999:localhost:9999 username@proxy_server
In your destination_server, add this to the command that is used to start your server.
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999
Then start remote application in eclipse that connects to localhost:9999.
-- If Eclipse is very slow in remote debug mode, try to remove (all) breakpoints and expressions in eclipse.
-- Use ssh tunnel, you can do a lot of other stuff.
-- We can use ssh tunnel to test code locally without really deploy to aws.
ssh -f -N -L18983:remote-host:remote-port $USER@host-in-middle
SOCKS and dynamic port forwarding
1. .ssh/config
host server
DynamicForward 1080
2. ssh -fND localhost:1080 bastion_server
ssh -fND 1080 bastion_server
curl --socks5 localhost:1080 remote_url
Java code
-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=3000
System.setProperty("socksProxyHost", "127.0.0.1");
System.setProperty("socksProxyPort", "3000");
Install Proxy SwitchySharp in Chrome
-f send this ssh operation into the background after password prompts
-N do not execute remote command or wait for the user to provide any commands
-L static port forward
-D the local port to listen on
- for dynamic port forwarding
Related
Create tunnel to remote Cassandra via man-in-the-middle
ssh -f host-in-middle -L 9042:destination-cassandra-server:9042 -N -v
Resources
SSH Tunneling Explained
SSH Tunnel - Local and Remote Port Forwarding Explained With Examples
To do this, run this in the proxy_server:
ssh -f -N -L9999:localhost:9999 username@destination_server
Run this in your local server:
ssh -f -N -L9999:localhost:9999 username@proxy_server
In your destination_server, add this to the command that is used to start your server.
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999
Then start remote application in eclipse that connects to localhost:9999.
-- If Eclipse is very slow in remote debug mode, try to remove (all) breakpoints and expressions in eclipse.
-- Use ssh tunnel, you can do a lot of other stuff.
-- We can use ssh tunnel to test code locally without really deploy to aws.
ssh -f -N -L18983:remote-host:remote-port $USER@host-in-middle
SOCKS and dynamic port forwarding
1. .ssh/config
host server
DynamicForward 1080
2. ssh -fND localhost:1080 bastion_server
ssh -fND 1080 bastion_server
curl --socks5 localhost:1080 remote_url
Java code
-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=3000
System.setProperty("socksProxyHost", "127.0.0.1");
System.setProperty("socksProxyPort", "3000");
-f send this ssh operation into the background after password prompts
-N do not execute remote command or wait for the user to provide any commands
-L static port forward
-D the local port to listen on
- for dynamic port forwarding
Related
Create tunnel to remote Cassandra via man-in-the-middle
ssh -f host-in-middle -L 9042:destination-cassandra-server:9042 -N -v
SSH Tunneling Explained
SSH Tunnel - Local and Remote Port Forwarding Explained With Examples