# SSH over public LAN?

I am using two laptops (OS X and Windows 10) at a Starbucks and want to transfer a file from one to the other without using a USB flash drive. It is a large file so I don't want to send it over the internet, rather I want to use the local network. How can I set up an SSH over LAN? Is this possible at a public network like at Starbucks or do I need to control port forwarding on the router level etc?

I set up an ssh server on the target host in Cygwin and successfully can connect to it there via ssh -v localhost. I can also connect there using ssh -v username@172.31.98.84 (using the local IP that I find using ipconfig on Cygwin and reading the line titled "IPv4 Address"). However, when I try this same SSH command from the MacBook client to attempt to connect to the Windows host, it fails by timing out..

• If I'm not mistaken, Starbucks configuration separates each device connected and does not allow LAN traffic between devices connected to the same access point. On a normal wireless network, it should be possible, but public wireless networks sometimes try to improve security and do not allow it. – user2313067 Sep 26 '15 at 5:47

The easy way to transfer files using SSH-like technology is probably to use the scp command that comes with OpenSSH.

scp username@172.31.98.84:/file .

If you want to try a GUI, WinSCP.net is good for Windows. You could have it connect to 127.0.0.1 to see what filenames appear.

It sounds like one system might not be accepting traffic on TCP port 22. That could be due to a lack of an SSH server, or it could be because of firewall-like technology blocking the traffic. I suggest "netstat -na" (should work on Unix-ish systems, which I understand Mac OS X to be... also works on Microsoft Windows) to confirm whether you're listening on TCP port 22 (and on what address). Otherwise, can you run sshd to start an SSH server?

As for whether systems can communicate with each other, that depends on how things are set up. In theory, Starbucks could restrict traffic between devices on the Wi-Fi, making such communications unable to happen over the Starbucks network. In practice, many organizations don't bother with such protections. I don't know what Starbucks does recently, and chances are that such details may be subject to change over time.

Another possibility may be to use an "Ad hoc" Wi-Fi network. If you can do that with both of your computers, you may not need to even use Starbucks's Wi-Fi equipment at all (which means that Starbucks's Wi-Fi would not be causing any problems).

Turning off Windows Firewall, as suggested elsewhere by another answer, is likely to help the Mac communicate to the Windows Firewall. It's actually an approach that is NOT recommended, despite the fact that it may work. That approach may be easy, but also cause unnecessary exposure to security risks. Better approaches can be done, like simply making a single rule/exception in the Windows Firewall software so that TCP port 22 can be reached from external traffic. You may wish to test such connectivity from an environment that may be easier to troubleshoot some things (like at home, with similar machines, on a wired network).

I hope that answers your questions. Some of the data you provided is a bit vague (what system was able to run "ssh" successfully? What system had that IP address?)

I suggest you start by turning windows 10 firewall off. Then ping windows 10 machine from your second machine (OS X) to see if it is reachable or not.

If ping works OK, issue this command on your OS X machine: telnet 172.31.98.84 22

If it says that it is connected, then your windows 10 machine is listening on SSH port. Now try ssh windows 10 machine, if it works, then you need to allow port 22 for incoming connections on your windows 10 firewall once you have it turned on again.

It's possible to have SSH setup on a public LAN - though IMO, it is not the safest way to go if you are not wary of the problems in having a public SSH server. FYI - some things to be kept in mind are listed in this link.

From your description, I'm assuming SSH is already setup on your Windows machine.

On your Macintosh, you will have to make sure SSH is running. You can check this by:

ps aux | grep sshd

on your Terminal. It should give you some information like process number, start time etc, if SSH daemon is already running.

If you see nothing from the above command, SSH is most likely not enabled and running. On your Macintosh, to enable SSH:

System Preferences -> Sharing -> Remote Login

should be checked. To check your Macintosh's IP, do ifconfig and find out the inet address from the interface that you are connected to (en0/en1/..).

If the above method fails, you'd probably have to add static IPs on both your machines and then try SSH.

Check this link, though it speaks for Ubuntu, the same should apply for your scenario as well:

Another option to consider is SCP (Secure Copy), which is used to securely transfer files over SSH.