Use ssh key for remote java debugging using intellij - java

I want to do remote java debugging using Intellij by connecting to a running program on a remote machine.
However, I use an ssh key to access this remote machine and cannot find any place to specify this key in the remote configuration window. Any idea how this can be done? Thanks!

You should first create an ssh tunnel to the remote machine and then connect to the program just as if it was running on your own system.

Related

Remote debugging via IntellijIdea

I want to configure debugging flow for the application that is placed on a dedicated Linux server. I can connect to the server via SSH for now(with private key protection). F.E. ssh -i private_key.txt user#host. But I can't create a connection to the server via Intellij Idea to debug remotely(sample on the picture).
Q: do I need to add some properties to the java application. Or I need to build a connection in a different way.
You need to start the JVM on a remote host with the command line IDE shows you. And make sure the port and host that are specified in this command is accessible from the host where IDE is running.

Connect the other user through remote machine on local machine?

I wanted to connect a Remote machine using java and have to run some commands from cmd prompt. To do this, I need a confirmation the tool (AutoIt) which i picked is working fine for me. Is there any possible to connect two users in our laptop and connect the other user by remote machine.. so that i can verify and proceed..
Any possibility to write a program to ssh to remote machine and execute some commands?
You can use JSCH
JSch is a pure Java implementation of SSH2.
JSch allows you to connect
to an sshd server and use port forwarding, X11 forwarding, file
transfer, etc., and you can integrate its functionality into your own
Java programs

Java Debugging over 2 machines

I am working in Linux environment where my java process is running on Machine C.
in order to connect to Machine C from my machine A i need to connect through B for security reason and there is no option to connect directly to machine C.
is there any way to debug the java process that running on machine C.?
Thanks in advance
You can set up a tunnel through machine B. You can use ssh tunneling by issuing this command from machineA:
ssh root#machineB -L 5005:machineC:5005
You will need to configure your IDE to debug remotely, pointed at machineA port 5005, and configure the remote JVM on machineC for remote debugging on port 5005, something like this:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
Assuming your IDE is running on the same machine as the ssh client, that is, machineA, you can point your IDE to localhost:5005 and the ssh command will attempt to tunnel all connections you make to localhost:5005 through to machineC:5005.

Start a java application from a remote computer using ssh protocol

I want to start my java app remotely. I'd like to use the SSH protocol as a way to communicate. Is there a library that will help do this?
SSH client and server in java
But I would use just ssh support built in the system, so you connect to the box with ssh and then just use terminal to access command-line console of your java app.

how to access a remote database in java which can be accessed only through ssh

I need to access the remote MYsql database from java which can be accessed only through ssh
SSH tunneling works perfectly fine for my application as most of the linux systems come with built in ssh client.
java.sql.Connection extension for SSH
what if i need to access the database from windows system, by using putty or some other ssh client.
can we do ssh tunneling in windows system as if in ubuntu systems.:)
Yes, you can, see Using PuTTY under Windows to create an SSH tunnel to your NetManager. Basically you need to set up a tunnel to the mysql port and then you can use the JDBC as natural without it being aware of the tunneling happening
There are plenty of SSH clients for java:
Apache MINA SSH
Java Secure Channel (JSCH)
github.com/shikhar/sshj
http://orion-ssh2.sourceforge.net/
Probably you can take a look and see who is going to work for you, but I think jsch could solve your probelm. See examples here

Categories