• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Using NSTask to start ssh tunnel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using NSTask to start ssh tunnel


  • Subject: Using NSTask to start ssh tunnel
  • From: "Steve Mills" <email@hidden>
  • Date: Thu, 28 Feb 2008 12:20:38 -0600

I have the source code for SSH Tunnel Manager, which we use to create a tunnel to our home office in another state. Something has changed recently, either with our home office's servers, my ISP, or 10.5.x is doing something differently than 10.4.x. The result is that the first time I do something that requires the tunnel each morning, the tunnel has quietly timed out or gone bad, even though SSHTM still thinks the tunnel is alive. I keep the tunnel going 24/7.

What I'm trying to do is add an option to SSHTM so it sends the ServerAliveInterval option along with the ssh command. A NSTask is used to build the command. Each argument is added to a NSMutableArray. That array is given to NSTask with setArguments. The code I've added looks like this:

	[arguments addObject: @"-o"];
	[arguments addObject: @"\"ServerAliveInterval 180\""];

I've also tried it as a single string:

	[arguments addObject: @"-o \"ServerAliveInterval 180\""];

When I run this and it connects, I get the error:

2008/02/28 11:57:05 SSH Tunnel Manager[61509] OpenSSH_4.5p1, OpenSSL 0.9.7l 28 Sep 2006
command-line: line 0: Bad configuration option: ServerAliveInterval 180


The man page for ssh shows one example of using the -o option, and it uses double-quotes around the argument given to -o:

ssh -o "VerifyHostKeyDNS ask" host.example.com

The command being built by SSHTM looks correct to me:

ssh -N -p 22 -g -c 3des -o "ServerAliveInterval 180" email@hidden -L 5003/1.2.3.4/5003

If I copy that string from SSHTM and paste it into Terminal, the tunnel is created without generating that error. I'm a Cocoa newbie and know very little about ssh and this type of thing. Any ideas?

_________________________________________________________
Steve Mills                              Me: 952-401-6255
Senior Software Architect                         MultiAd
email@hidden                       www.multi-ad.com


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: complex views in a tableview
  • Next by Date: Re: Binding to a controller in a different nib
  • Previous by thread: Can someone send me the MoreAuthSample?
  • Next by thread: Re: Using NSTask to start ssh tunnel
  • Index(es):
    • Date
    • Thread