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.

I am SSHing into a Linux machine from my Mac OS X (Snow Leopard) and then want to copy a file from the Linux machine into my Mac.

I used ssh user@linuxmachine address but then when I use scp filename user@mymacsipaddress:filepath, nothing happens at all.

I tried SSHing to my Mac from the Linux prompt but nothing happens in that case either. I have enabled remote access in system preferences/sharing and tried:

ssh local host 
ssh mymacsipaddress and
ssh user@mymacipaddress

from my Mac prompt and all of them seem to work so SSH seems enabled. What might be wrong? Do I need to enable anything else on my mac ?

I ran this command to see if port22 is listening netstat -na | grep 22 tcp4 0 0 *.22 . LISTEN and got the above result.

share|improve this question

migrated from stackoverflow.com Nov 30 '11 at 15:15

This question came from our site for professional and enthusiast programmers.

    
this is the error i eventually get ssh: connect to host macipaddress port 22: Connection timed out –  msohail Nov 30 '11 at 7:20
    
i ran this command to check connection with port 22 nc -vv ipaddress 22 and get the following result: Connection to ipaddress 22 port [tcp/ssh] succeeded! SSH-2.0-OpenSSH_5.2 Protocol mismatch. –  msohail Nov 30 '11 at 7:22

2 Answers 2

Since you can log in with SSH from the Mac to the Linux machine, the quickest and easiest solution (at least to provide on a web site like StackOverflow) may be to run the scp command from the Mac. Something like: scp user@linuxmachine:/path/to/file /destination/on/mac

To further troubleshoot what's going on with connecting from the Linux machine to the Mac, you may have better luck asking at the appropriate Stack Exchange (maybe apple.stackexchange.com but I'm not sure).

(UPDATE: This question was migrated from StackOverflow to SuperUser, so I guess SuperUser is the place. Good to know.)

While you'll probably get a better answer at another Stack Exchange site, here's a quick and crude way you can try to pinpoint where the trouble might be, perhaps this might help:

  • From the Linux machine, try telnet N.N.N.N 22 (substituting your Mac's IP address for N.N.N.N). And, yes, that's a space before the number 22.

If you get a result that looks like this, then everything is fine network-wise and you probably need to look into the settings in your sshd_config file on the Mac:

Trying N.N.N.N...
Connected to N.N.N.N.
Escape character is '^]'.

(This is because scp uses the SSH protocol. Fix your SSH problem and you will probably fix your scp issue.)

If you do not get something that looks like that, it's time to check some network related things.

  • Is there NAT going on between the Mac and the Linux machine? What's the IP address you're using? That would totally explain an ability to be able to connect from the Mac to the Linux machine but not the other way around. Can you ping your Mac's IP address from the Linux machine?
  • Look for firewall rules and logs on both machines

I'm suggesting a somewhat primitive way to troubleshoot. There are no doubt ways to crank up the logging on both ends and get a better idea of what's happening.

UPDATE: And now that the question has been migrated to SuperUser, maybe some people will provide more detailed and foolproof ways to troubleshoot this issue. Good luck!

share|improve this answer
    
thanks, i tried that and it works. But i was wondering if you can also suggest what to look into to to be able to scp from inside the linux computer to my mac. The linux computer has scp and ssh enabled. –  msohail Nov 30 '11 at 7:56
    
OK, added a bunch more info / suggestions to my answer. –  Trott Nov 30 '11 at 14:02

You might need to enable remote login on your Mac. Go to System Preferences > Sharing and turn on the Remote Login checkbox.

share|improve this answer

Your Answer

 
discard

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