This guide will walk you through installing the React Native SSH SFTP library and configuring it for both iOS and Android platforms.
Install the Package
Install the library using your preferred package manager:
npm install @dylankenneally/react-native-ssh-sftp
iOS Setup
Update your Podfile
The library requires a specific fork of NMSSH that includes an updated version of libssh. Add the following line to your Podfile located at ./ios/Podfile:target 'YourProjectName' do
pod 'NMSSH', :git => 'https://github.com/aanah0/NMSSH.git'
# ... rest of your target details ...
end
We use aanah0’s fork of NMSSH to get a required later version of libssh. Install pods
Run pod install in your iOS directory: Optional: Automate pod installation
Add a postinstall script to your package.json to automatically run pod install after npm install:{
"scripts": {
"postinstall": "npx pod-install"
}
}
The pod-install package is a cross-platform way to handle iOS pod installation.
Troubleshooting iOS
Having OpenSSL issues on iOS?If you are using Flipper to debug your app, it already includes a copy of OpenSSL which can conflict with the version used by NMSSH.To resolve this, disable Flipper by removing or commenting out the following line in your Podfile:# flipper_configuration => flipper_config,
iOS Simulator Not SupportedThis package currently doesn’t support the iOS simulator. You will need to test on a physical iOS device. See this issue for more information.
Android Setup
No additional configuration is required for Android. The library works out of the box after installation.
Linking
This library uses React Native autolinking (introduced in React Native 0.60+). Manual linking is not required.
If you’re using React Native 0.60 or later, the library will be automatically linked. Simply rebuild your app after installation.
Next Steps
Now that you have the library installed, check out the Quick Start guide to learn how to connect to an SSH server and execute your first command.