I’ve modified a simple wrapper for the libssh2 library that now has the following functionality:
- Code moved to separate classes to allow reusability
- Multiple sessions to different servers can be achieved with a few lines of code
- A Session can be passed to the operator class allowing operations (commands sent to it), more will be added
At the current time it connects fine to OSX and Linux sshd however I can’t connect to ESXi even with the correct password it reports incorrect, However I think I Can resolve this shortly.
I fought with this about a year ago, and for some strange reason never managed to get things to compile or link. I chalk this down now to my lack of understanding with Objective-C/linking concepts. However it turns out that it is relatively simple (ensure you have Xcode 4 installed before trying).
- Point browser to http://www.libssh2.org/ and download the latest snapshot to a temporary location.
- Open a terminal window and navigate to the directory containing the the source files and run the following:
- This will output numerous content to the terminal window, present a summary of the configuration options and create a header file needed for compilation. (Running make / make install is NOT required).
- Open Xcode and create a new Xcode project, which should be a (Mac OS X -> Framework & Library -> C/C++ Library) and give it a Product Name (e.g. libssh2) and ensure that the type is Static then click create.
- Xcode will open with an empty project displaying the Build Settings. At this point we can start adding the files that are part of the libssh2 source tree.
Continue reading SSH with Cocoa (Xcode and libssh2)