How can I display the Authentication Banner

Some SSH servers are configured to show an authentication banner to the user prior to authentication.

If you want to display this in your own application you can configure a BannerDisplay callback on the client’s context.

First, implement BannerDisplay interface, in this simple example we will just write the message to System.out.

BannerDisplay display = new BannerDisplay() { 
   public void displayBanner(String message) { 

Next, we just have to configure this on the SshClientContext for each connection. The simplest way of doing this is to create and pass a SshClientContext instance to your SshClient

SshClientContext ctx = new SshClientContext();

try (SshClient ssh = SshClientBuilder.create()
		.build()) {