View Full Version : Cocoa App SSH
Jan 28, 2008, 03:26 PM
I have just recently decided to learn ObjC and Mac programming. The application I am developing needs to connect through SSH to a box running Fedora in order to run some bins on it, and get the output data, for data processing on the local (Mac) machine. What's the best way to accomplish this? Should I somehow interface Apple's Terminal Application? Is that possible? Or can I make my application SSH to the given server, run commands on it and retrieve data? If so, what libraries or frameworks do I use? Thank you in advance for all your comments.
Jan 28, 2008, 04:09 PM
Use NSTask (http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSTask_Class/Reference/Reference.html) to run the built in ssh command line tool.
Note this is not using the Terminal application: it will work even if Terminal is deleted. But the ssh command is the same as if you typed ssh at the command line.
You may find the NSTask page at cocoadev (http://www.cocoadev.com/index.pl?NSTask) useful.
Jan 28, 2008, 07:53 PM
Thanks much! I tried to write some quick code using NSTask and I kept getting errors, then I read the link your provided me with and everything works perfectly now. Thank you once again.