Blocking Ssh Client
Blocking wrapper for SshClient for Java compatibility.
This class wraps the async SshClient with blocking calls using runBlocking. For Kotlin code, prefer using SshClient directly with coroutines.
Usage from Java:
BlockingSshClient client = new BlockingSshClient("example.com", 22, myHostKeyVerifier);
try {
client.connect();
client.authenticatePassword("user", "password");
SshSession session = client.openSession();
// ...
session.close();
client.disconnect();
} catch (SshException e) {
// handle connection or auth failure
}With custom transport:
BlockingSshClient client = new BlockingSshClient(myTransportFactory, myHostKeyVerifier);Constructors
Create a blocking SSH client for TCP connection.
Create a blocking SSH client from configuration.
Create a blocking SSH client with custom transport factory.
Properties
Functions
Authenticate using the strategy-based AuthHandler flow.
Authenticate using keyboard-interactive authentication (RFC 4256).
Authenticate using password authentication.
Authenticate using public key authentication (RFC 4252 ยง7).
Disconnect from the SSH server.
Start dynamic (SOCKS5) port forwarding.
Start dynamic (SOCKS5) port forwarding bound to localhost.
Enable SSH agent forwarding with the provided agent.
Forward Ktor byte channels through an SSH direct-tcpip channel.
Start local port forwarding.
Start local port forwarding bound to localhost.
Create a org.connectbot.sshlib.transport.TransportFactory that tunnels through this SSH connection.
Open a session channel (RFC 4254 section 6.1).
Open an SFTP session for file transfer (blocking wrapper).
Send an SSH ping to the server and return the result.
Start remote port forwarding.