Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to increase the default time out when trying to connect to a remote machine via SSH on Mac OS X?

ssh -D 9999 user@host
share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

You need to change the ServerAliveInterval, as explained in ssh_config(5):

Sets a timeout interval in seconds after which if no data has been received from the server, ssh will send a message through the encrypted channel to request a response from the server. The default is 0, indicating that these messages will not be sent to the server.

For example, create ~/.ssh/config and add:

Host *
    ServerAliveInterval 120

This will apply to all connections. For a single connection, just use the -o option as explained in ssh(1):

ssh -o ServerAliveInterval=120 user@host
share|improve this answer
    
Why I'm still getting ssh: connect to host hostname port 22: Operation timed out –  Chiron Jan 3 '12 at 12:31
4  
Well, then this is not the answer to your actual problem. Why didn't you include the error message in your question? This is a completely different issue and most likely a problem with the server itself. You can either rewrite your question to state the actual problem that you have (in that case I'll delete my answer) … or accept this and ask a new question. Whatever makes more sense to you. –  slhck Jan 3 '12 at 12:35
1  
Just leave this answer up. Not your problem that the user didn't bother to ask the right question. –  Daniel Beck Jan 3 '12 at 15:02
add comment

Specify the option "ConnectTimeout" for connection timeout, eg

ssh -o ConnectTimeout=240 -D 9999 user@host

Or in ~/.ssh/config add

Host *
  ConnectTimeout 240
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.