0

For remote connection: ssh -Y remoteuser@remoteip

I need to open terminal in remote machine only; for example a gnome-terminal.

3
  • 1
    The question is not well written. Can you please detail it? Why it is tagged as Java and Javascript? Commented Jun 19, 2017 at 12:27
  • I need to write code in java for opening terminal in remote machine using commands in java. That's why i tagged java Commented Jun 19, 2017 at 12:28
  • For the record: please provide some feedback if you find my answer helpful; or if I could/should add something to make it "accept" worthy in your eyes. Commented Jun 20, 2017 at 8:38

1 Answer 1

1

This is a typical use case for a library such as 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.

Beyond that: please understand that not every language is suited for all kinds of problems - personal opinion here: I would rather avoid using Java for tasks such as "controlling a remote system" somehow. First of all; I would avoid re-inventing the wheel; you really want to rely on existing solutions. But instead of programming something in Java, I would rather look to other solutions, such as scripting with python; or using tools such as salt, puppet, chef, ...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.