4

I have spent a few hours hunting for the problem here. I have been working with Macs for years now and never had this problem, and have ssh into eC2 instances thousands of times. I recently received at work a new MacBook Pro. SSH runs as a service, meaning here it does not return any error that it is not found. But no matter what server or EC2 instance I try to ssh into, as I have done a million times before I get a timeout. Before you ask, I have looked all over for this problem. I have also looked for the normal ~/.ssh directory, which seems to be missing and therefore cannot find any config file.

The following is the Mac info:

Catalina 10.15.2

Model Name: MacBook Pro Model Identifier: MacBookPro16,1 Processor Name: 8-Core Intel Core i9 Processor Speed: 2.3 GHz Number of Processors: 1 Total Number of Cores: 8 L2 Cache (per Core): 256 KB L3 Cache: 16 MB Hyper-Threading Technology: Enabled Memory: 16 GB Boot ROM Version: 1037.60.58.0.0 (iBridge: 17.16.12551.0.0,0) Serial Number (system): C02ZNMV5MD6N Hardware UUID: 27B1EDF5-B1D2-5F86-BD12-D646F36D9D2D Activation Lock Status: Enabled

ETA: Yes, from a Windows machine I can access the EC2 network. Yes, I have the correct PEM file. And yes, I have made sure security groups in AWS are correct. For some reason the normal ssh -i etc. picked up directly from AWS connect for the EC2 instance always times out.

Crazy question: does the ssh in Catalina demand another command, addition or some other parameter besides -i?

(I do not seem to be able to ping, telnet etc. either. So something seems to be preventing the OS from going out on ssh port 22.)

Does anyone know of or has had this problem and a fix for it? I am fairly sure it is some type of configuration in ssh or in the Network configurations.

It is driving me crazy. Any and all help would be greatly appreciated!

4
  • I assume your Mac isn’t using a VPN nor any firewall software?
    – Rob
    Commented Jan 19, 2020 at 18:51
  • at the moment no. No VPN or firewall. I am beginning to suspect it is coming from the VPC that was already set up for this company. Even with -vvv I am not getting a response from the server (even using AWS built in connector Terminal.) I know something is off...but for the life of me I cannot figure out why it times out all the time on all servers, even those I built just for a test.
    – twg
    Commented Jan 19, 2020 at 19:48
  • 2
    Did you ever solve this? I recently upgraded to Catalina (10.15.5) and can no longer SSH into EC2 instances- "port 22: Operation timed out". I haven't found a solution anywhere. Commented May 30, 2020 at 13:54
  • I had a very similar issue and finally managed to resolve it in my case! My answer is on https://apple.stackexchange.com/ as that forum seems more appropriate. Hope it will be helpful to others.
    – f-hollow
    Commented Apr 18, 2023 at 8:00

1 Answer 1

-1

New Macbook Pro owner/user here. Same issue, despite all configs being identical to my Windows 10 pc and Ubuntu 20 laptop.

For some reason, this doesn't work for me on my Macbook, but does work on Windows and Ubuntu.

ssh -i path-to-keyfile.pem user@ipaddress

But creating an SSH config file and adding my AWS keyfile to my keychain works:

open ~/.ssh/config if the config file exists, or touch ~/.ssh/config if not.

Edit this config file as follows:

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa

Note: I don't know for sure, but I imagine only the 'AddKeysToAgent' and 'UseKeychain' parts are what's important. I'm using the 'IdentityFile' part for connecting to my git repos.

Save the config file and exit. Next, make sure your keyfile isn't too open, otherwise you won't be able to add it to your keychain:

chmod 600 path-to-keyfile.pem

Finally, add the keyfile to your keychain:

ssh-add -K path-to-keyfile.pem

Now on Mac, I'm able to ssh into my AWS instance without the -i flag:

ssh aws-username@aws-ipaddress

Hope this helps. I found the solution here: https://www.cloudsavvyit.com/1795/how-to-add-your-ec2-pem-file-to-your-ssh-keychain/

PS - I'm also unable to sFTP into AWS using Filezilla on Mac, so I'm looking into this as well.

Update on Filezilla: A bit bizarre and I haven't figured out how to save my settings, but for now this answer works: https://superuser.com/questions/280808/filezilla-on-mac-sftp-with-passwordless-authentication

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