Skip to main content
This guide will help you connect to an SSH server and execute your first command in just a few minutes.

Prerequisites

Before you begin, make sure you have:
  • Completed the installation steps
  • An SSH server you can connect to (hostname, port, username, and password or private key)
  • A React Native project set up and running

Connect and execute a command

Follow these steps to establish your first SSH connection and run a command.
1

Import the library

Import the SSHClient class into your React Native component:
2

Connect to your server

Use either password or key-based authentication to connect:
3

Execute a command

Run a command on the remote server:
4

Clean up

Always disconnect when you’re done:

Complete example

Here’s a full React component that connects to an SSH server and executes a command:
This example uses password authentication for simplicity. In production, consider using key-based authentication for better security.

Next steps

Now that you’ve successfully connected and executed a command, explore more features:

Interactive Shell

Learn how to create interactive shell sessions.

SFTP Operations

Transfer files and manage directories.

Authentication

Understand authentication methods and key management.

API Reference

Explore the complete API documentation.
Last modified on March 26, 2026