I have a small server running Ubuntu (12.04.1 LTS). I can control the server from putty but I want to do this with GUI. I know how to create Java applications with GUI. Anyway my question is, how to send ssh command when button clicked.
The Jsch library allows you to do ssh programmatically from java. This should allow you to send the necessary commands from you gui to your server.
One more or less simple way to do this is to open a ssh tunnel and forward a port from your local machine to the server. I recommend using a key pair to omit entering a password. Next you write your application which could consist of two parts, your local GUI and some server which executes the commands on the server.
I still think that this a very complicated solution but the choice is yours.
Related
I am trying to login into Linux box through JSch code.
Issue: I have a problem that after login into Linux box through PuTTY, it will directly prompt me to select one option 5, then I need to enter a value among 1,2,3,4,5 which then goes to respective directory.
Example: after login into Linux machine it give me five environments:
prod
qa
dev
cert
none
so I need to choose among above five.
If I enter 3 then it will change to the dev environment.
Please help me and let me know how to implement this in JSch or related Java code.
Those are not commands. Those are human inputs.
System that requires an human interaction like this is not designed to be automatable. You should talk to the server administrator to offer better "API".
If that's not possible, you have to simulate the interaction.
For an example, see
Executing multiple commands over SSH "exec" channel on firewall device with Java JSch does not work
In our project (CMS) we are currently using Mindterm for launching SSH terminal to Network Elements and different Virtual Machines. Client download .jnlp file that launch Swing based GUI with ssh terminal to configured address.
Since mindterm is getting out of support at the end of this year (2021), we are looking for replacement, my question is can anyone recommend something providing similar functionality, we don't want into writing this by our own.
Thanks
P.S. I know that e.g. Putty, mRemoteNG exist but customer want to have ability start preconfigured with IP address terminal from CMS application.
Solution?
-- it looks like i may be able to use the x-11 forwarding in jsch and and use the java Desktop class to launch a file browser. Not sure if this will work.
What I am trying to do is, within a java application, open a connection to a server or another computer. I have found a way to do this that opens a terminal window but what I want is a gui/explorer/finder like window that allows me to drag and drop files between the machines.
--Edit--
An example: When i use an sftp application i can open a graphical window and drag files from my computer to folders on the remote server. just like an explorer or finder window. I am looking for a way to implement this type of functionality in java. I want to open a connection to a remote machine, then open a graphical window to browse the file system
You can use JSch to communicate with the server through SSH and
1. create your own GUI or
2. use X11 forwarding
you need two applications in each machine ,you can do this by TLS connection.
however it need a waiting thread in costumer machine (dragable) to get file from Tls port and stream it to new location or if you want to use just gui in one machine you can old applet or java Fx instead .
I want to create a voice chat which runs on the web browser.
The basic idea is that when I run the server.jar file, it will listen to a socket for connection, and when I type the ip and port on another computer on web browser(ex. 1.1.1.1:8082), the server will accept the connection and display an voice chat applet. Server.jar should contain all voice handlers. For example, if we have three computers, one with the server running while other two has web browser applet running and connected to the server, user1 talking will transmit over to the server, which then transmit over to user2.
So far, I have the applet and the server, but I am having trouble using the web browser to open the applet. It seems I need to use servlet and apache tomcat for the server side to make this work.
Can anyone confirm that I need to use servlet and apache tomcat to achieve this? Or can anyone suggest a better way to approach this project?
if it's peer-to-peer, everything can be written inside the applet.
Oh and as far as i know, there is no java voip libraries so you're going to have to port one from a C/C++ library or write it yourself.
I am attempting to run a Java application (specifically Minecraft) at my school on a mac computer. I wish to play online on my personal server, however the way the network is set up here the only way to access the internet is to enter network user/pass (The school uses a websense filter). Each student has one, and when you open a browser window a prompt will automatically ask me for it. The same user/pass is used to log into the machine, and some software will simply pick it up and go online without entering it a second time (ex. Safari just connects, Chrome however prompts for the user/pass).
Java applications however seem to be a mixed bag, some will connect, some will not. However none of them prompt me for the user/pass to the network.
So is there any way to force possibly through command line?) a Java application to log into the network?
Or is there possibly some other problem here?
You can set the proxy at the command line. This should help you: How do I set the proxy to be used by the JVM
In case you can't use your proxy directly you might try and install a local proxy such as CNTLM that connects to your network proxy and authenticates using the credentials you provide. The application would then not have to provide credentials. However, you'd have to provide your network credentials to CNTLM and thus should not forget to remove them when you are done.