npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@marcomueglich/react-native-ssh-client

v1.0.0

Published

React Native SSH Client Module

Readme

react-native-ssh-client

npm version npm downloads License: MIT

A React Native module for SSH client functionality, enabling secure shell connections from your React Native applications.

Disclaimer

This package is based on the code from react-native-ssh-sftp by Dylan Kenneally. The original package supports the old React Native architecture. This module adapts that code to work with React Native's new architecture (TurboModules).

Features

  • 🔐 SSH connection with password or private key authentication
  • 💻 Execute remote commands
  • 🖥️ Interactive shell sessions with PTY support
  • ⚡ Built with React Native's new architecture (TurboModules)
  • 🤖 Only Android support

Installation

npm install @marcomueglich/react-native-ssh-client

Or with yarn:

yarn add @marcomueglich/react-native-ssh-client

Usage

Connecting with Password

import SSHClient from "react-native-ssh-client";

const client = await SSHClient.connectWithPassword(
  "example.com", // host
  22, // port
  "username", // username
  "password" // password
);

Executing Commands

// Execute a single command
const output = await client.execute("ls -la");
console.log(output);

// With callback
client.execute("whoami", (error, result) => {
  if (error) {
    console.error("Error:", error);
    return;
  }
  console.log("Result:", result);
});

Interactive Shell

import { PtyType } from "react-native-ssh-client";

// Start a shell session
await client.startShell(PtyType.XTERM);

// Write commands to the shell
const response = await client.writeToShell("cd /var/log\n");
console.log(response);

// Execute more commands
const logs = await client.writeToShell("cat syslog | head -n 20\n");
console.log(logs);

// Close the shell when done
client.closeShell();

Disconnecting

// Disconnect when done
client.disconnect();

API Reference

SSHClient

Static Methods

connectWithPassword(host, port, username, password, callback?)

Connects to an SSH server using password authentication.

  • host: string - The hostname or IP address
  • port: number - The SSH port (usually 22)
  • username: string - The username for authentication
  • password: string - The password for authentication
  • callback: CallbackFunction<SSHClient> (optional) - Callback for connection result
  • Returns: Promise<SSHClient>

Instance Methods

execute(command, callback?)

Executes a command on the SSH server.

  • command: string - The command to execute
  • callback: CallbackFunction<string> (optional) - Callback for the result
  • Returns: Promise<string> - The command output
startShell(ptyType, callback?)

Starts an interactive shell session.

  • ptyType: PtyType - The type of pseudo-terminal to use
  • callback: CallbackFunction<string> (optional) - Callback for the response
  • Returns: Promise<string>
writeToShell(command, callback?)

Writes a command to the active shell.

  • command: string - The command to write
  • callback: CallbackFunction<string> (optional) - Callback for the response
  • Returns: Promise<string> - The shell output
closeShell()

Closes the active shell session.

disconnect()

Disconnects from the SSH server.

PtyType Enum

Available PTY types for shell sessions:

  • PtyType.VANILLA - Basic terminal
  • PtyType.VT100 - VT100 terminal emulation
  • PtyType.VT102 - VT102 terminal emulation
  • PtyType.VT220 - VT220 terminal emulation
  • PtyType.ANSI - ANSI terminal emulation
  • PtyType.XTERM - XTerm terminal emulation

Example

import SSHClient, { PtyType } from "react-native-ssh-client";

async function performSSHOperations() {
  try {
    // Connect
    const client = await SSHClient.connectWithPassword(
      "example.com",
      22,
      "admin",
      "secure-password"
    );

    // Execute a command
    const uptime = await client.execute("uptime");
    console.log("Server uptime:", uptime);

    // Start interactive shell
    await client.startShell(PtyType.XTERM);

    // Run commands in shell
    await client.writeToShell("cd /var/www\n");
    const files = await client.writeToShell("ls -la\n");
    console.log("Files:", files);

    // Cleanup
    client.closeShell();
    client.disconnect();
  } catch (error) {
    console.error("SSH Error:", error);
  }
}

Platform Support

  • ✅ Android
  • ⏳ iOS (not yet supported)

Requirements

  • React Native >= 0.68
  • Android minSdkVersion 21

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT © Marco Mueglich

Author

Marco Mueglich

Repository

https://github.com/MarcoMueglich/react-native-ssh-client

Issues

Report issues at: https://github.com/MarcoMueglich/react-native-ssh-client/issues