Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know Apple's article about SSH. I know the video about how to log in to Mac by SSH.

I have the following settings in MacBookA

enter image description here

I am trying to connect to it by the command in the picture in MacBookB

ssh <username>@<address>

where and are my appropriate username and address, respectively.

I get the following error message

[1448]ssh <username>@<address> 
ssh: connect to host <address> port 22: Operation timed out

I have MacbookA on. I put the user of MacbookA online and offline by MacbookA, then tried to log in MacbookB's terminal with Operation timed out -error.

How can you connect to your remote Mac by SSH in terminal?

share|improve this question
So you are within the same network as the MacBook you want to connect to? – Darryl Hein May 9 '09 at 9:35
up vote 3 down vote accepted

Are they both on the same local network? If so, can you connect using the Bonjour name?

ssh sam@sams-py.local
share|improve this answer
@Lee: I have two separate internet connections. I use the one connection for MacbookA and the other for MacBookB. I use cable. I think that my MacBooks are not in the same local network, since it would mean that: oneInternetConnection for 2Macbooks. – Masi May 9 '09 at 9:40
OK, that means my answer probably isn't going to work in your real environment. You could still try connecting the two by a LAN (even ad-hoc using wi-fi or an ethernet cable) to discriminate between SSH and routing failures. – user448 May 9 '09 at 10:16

You need to make sure that in both computers port 22 is open (firewalls anywhere?) and that there is a network route from A to B. (not behind NAT or behind NAT and forwarded/DMZ)

Are you able to ping both computers from eachother? [answered: yes]


Do either computers' IP addres fall in one of the following ranges?:, or If so, they are behind a router of some sort and you will need to make sure the router knows to forward requests to the right computer through NAT/port forwarding, or setting up the DMZ in the routers configuration to the receiving computers' internal IP address.

For example, My Macbook Pro is and the router is lets say my public IP is (all are fictional but for the example this will do fine.)

I have setup my router (which is also my broadband modem) to forward every request to by putting it into the routers configuration via the utility that came with it.

now when i try to connect to the router is the first responder but it knows to forward the request to my Macbook Pro so in the end my Macbook Pro responds through the router back to the requesting party.

If you don't setup any kind of forwarding on your router, it is likely to deny any kind of request from the outside world, and even if it doesn't, it's not going to know where to send the request on the internal network. (these days there is pretty much always an internal network even if you only use one computer).

I think the issue is not so much in the firewall but more likely to be in your router settings, you need to make sure that the receiving end actually gets to handle the request.

share|improve this answer
@Kris: I can ping now to MacBookB after I disabled Stealt Mode. I have "Allow only Essential Services" at Security > Firewall. There is Remote Login (SSH) at the big box there. – Masi May 9 '09 at 8:14
I disabled PeerGuardian at MacBookB. The problem still persists. – Masi May 9 '09 at 8:18
I use only MacBook's internal Firewall now, so I do not use NAT. – Masi May 9 '09 at 8:23
@Kris: I do not have router. My both RJ45 cables are in the walls. My ip address is not within your mentioned ranges. This suggests me that I cannot have a router. – Masi May 9 '09 at 12:17
@Masi, actually it doesn't suggest you don't have a router. having the same IP address in network preferences as on would. – Kris May 9 '09 at 14:06

What do you mean by "appropriate username and address"? Is the address an internet addres, a LAN address, or bonjour? Have you tried turning off all firewalls to see if it's possible then? You might want to play with Utilities/Network Utility.

I see from an answer that you are on two different internet connections. Are you sure that the individual routers/cable modems don't have firewalls built in?

share|improve this answer
@Andrew: I mean my real username and real ip-address. My address is an internet address. I turned my firewalls off and the same problem occurs. Thank you for the app up! – Masi May 9 '09 at 9:47

Your Answer


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.