Super User is a question and answer site for computer enthusiasts and power users. 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 have a windows 7 machine and a linux machine. I want to SSH from windows to linux. How would I set this up if both are connected to my router at home? Would there be any changes necessary if I left my linux machine at home but took my windows machine with me to starbucks?

So far I've installed putty and disabled the firewall on both machines.

Ubuntu: sudo ufw disable

Windows: Simply disabled Windows firewall

Putty: Typed in the IP of my Ubuntu machine (both local and external IPs)

After I click connect, I get a connection refused message.

share|improve this question
You're better off making a mesh hamachi network with both Win7 and Linux and then you won't have to worry about opening up any pinholes on the router. sudo apt-get install openssh-server on ubuntu and then use PuTTY to SSH from the Windows 7 to the Hamachi IP of the Ubuntu Server. – kobaltz Feb 4 '12 at 23:11
Thanks, this worked well. I'm able to ssh from an external network now. Hamachi is convenient. I like not having to set up port forwarding and a dynamic DNS service. – barrrista Feb 5 '12 at 1:17
up vote 2 down vote accepted

First of all, both machines should be on the same subnet (e.g., 192.168.1.x). As an initial test, try pinging the Linux machine from Windows (ping -t <Linux IP>) and you should get a response. If you don't get a response, you won't be able to use SSH, and need to reconfigure your network.

Secondly, you need to install an SSH server on your Linux machine. Since you're using Ubuntu, follow this guide on how to install OpenSSH.

The SSH server will be set to be run in the background, and I recommend you turning the Linux firewall back on and opening the ports it's listening on (usually TCP port 22). You can do that with:

sudo ufw allow ssh

Once that is setup, and you can ping your Linux machine from Windows, you should be able to use Putty or any other Windows SSH client to connect to your Linux machine. Just input your Linux IP and port and you should be good to go.

Now, if you want to connect from outside your home network, you will probably need to configure port forwarding for your router. This greatly depends from manufacturer to manufacturer, but it basically involves mapping your WAN IP to your LAN IP for the SSH port. Google for <router name and model> port forwarding and you should get some results.

Port forwarding is only half of the equation, though. Your home Internet connection probably doesn't have a static public IP, which changes anytime you power cycle your router or your ISP forces an IP change. To get around having to remember your new public IP address everytime it changes, you can setup a dynamic DNS service. Which means you can enter a domain name (e.g. instead of an IP.

There are many free dynamic DNS services, such as No-IP, FreeDNS, etc. You usually have to run their client on your Linux machine which will update their DNS records anytime your public IP changes. Most routers though have this feature built-in, so check your router's admin page.

share|improve this answer
Thanks, not having to turn off the firewall is nice. – barrrista Feb 5 '12 at 1:21

You need to set up port forwarding on your router. Once this is done, you will be able to use your public IP address with Putty and your router will recognize the traffic and direct it to your Ubuntu box. Make sure you have a strong password for SSH to prevent prying eyes.

Good Resource: - will have router-specific directions for port forwarding.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .