How to Execute Linux/Unix Command on a Remote Server Using SSH [Snippets]

The JSsh-client is a Java-based library build on top of the JSch Library to perform an operation on the remote server over SSH and SFTP channels. It has the following features:

  • Test SSH connection with a remote SSH server.
  • Execute a command on a remote server using Execute Channel.
  • Execute commands on a remote server using Shell channel.
  • Upload/Download the file to/from the remote server from/to local using the SFTP channel.

How to Use It?

Step 1: Add Maven Dependency to POM.xml [Use Lastest Version]

Current version: 0.0.2

An Introduction to SSH – Secure Shell

What Is SSH?

SSH is a network protocol that allows a secure connection between different computers. SSH protocol also referred to as Secure Shell, provides many functionalities like,

  • Strong connection and security
  • Strong authentication
  • Maintains connection integrity
  • Strong encryption.

In general, there are different ways of logging in to a remote machine,