Skip to content
An SSH Wrapper
Objective-C Shell
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

This is a simple wrapper script, that allows simple and easy use of libssh2, from

It allows simple interactions with an ssh server, however terminal and sftp aren't implemented. To work with libssh2, the src archive needs to be downloaded from and placed in the same Directory as the file. This script (ensure +x) will unpack the src archive, configure and build it.

Usage: $ ./ ./archive.tar.gz

It then extracts the required headers and lib archive and places everything in a libssh2_xcode directory, which can then be added to your project (Ensure that libcrypto.dylib and libz.dylib are added to your project as well).

When compiling there may be warnings, this is due to a type issues strlen returning a long, when an int is required. If you want to remove these errors cast strlen to an int (int)strlen(string), where it occurs in the headers giving the warning.


  • (void)applicationDidFinishLaunching:(NSNotification *)aNotification


// Create server instance (this can be passed around as it contains the socket info etc..)

DFSSHServer *server = [[DFSSHServer alloc] init];	

[server setSSHHost:@"" port:22 user:@"dan" key:@"" keypub:@"" password:@"XXXXX"];

// Create connection instance, this will be changed at a later date to use class methods so wont

// need instantiating

DFSSHConnector *connection = [[DFSSHConnector alloc] init];

// Set connection status to Auto Detect (will check for keyboard/password/key)

// and connect

[connection connect:server connectionType:[DFSSHConnectionType auto]];

// if connected try the following commands

if ([server connectionStatus]) {

         NSLog(@”Server 1 connected”); 
         NSLog(@”%@”,[DFSSHOperator execCommand:@"uname -a" sshServer:server]);
// Close connection

[connection closeSSH:server];


You can’t perform that action at this time.