I am trying to get a working SSH server on my linux computer (ubuntu 14). Let's call this computer "Ubuntu". Ubuntu is connected to the internet through a shared internet connection from my Windows 10 machine (call it "Windows").

The network looks something like this (very linear):

Internet --> Router --> Windows --> Ubuntu

I installed my SSH server on the Ubuntu machine and can access it locally doing this: On Windows PC, I use PuTTY and connect via SSH using the inet adress of Ubuntu and SSH port. It works, but it is only local.

How can I make this work with my public IP adress? My public IP adress is the same for both machines (and it won't ever change so I don't need a name through ddns). Is there anything like Apache "Virtual Hosts" for SSH?

To complicate things a little bit, I'm running an OwnCloud server on the Windows machine through WAMP (apache). This is running on https, don't know if it could interfere with SSH configuration. I thought I could do something like using a Virtual Host to redirect

my.private.ip/ssh to SSH on the Ubuntu machine... does this make any sense?

Router --> Windows: (apache WAMP server) --> Virtual host for /SSH redirect to --> Ubuntu

Else, could I do something like connect to SSH using

192.168.xxx.xxx:port (through) yyy.yyy.yyy.yyy (where xxx is the local ip and yyy is the public ip)

Any help would be welcome, but please consider that I'm a total newbie and don't understand half of what I'm doing ;)

  • 3
    The key to success here is ip port forwarding. You need to configure your router to forward some port (maybe port 22) to port 22 of your Linux machine. Maybe you should also ask yourself why you have your Windows machine between the router and the Linux machine. Unless you connect your Linux machine to your router you will somehow also need to configure port forwarding on your Window machine. Before doing all this you should also be aware there are many bad people out there on the internet. They will try to brute force attack your ssh server. Jan 2, 2016 at 17:14
  • 1
    I'd suggest not using port 22, for the reasons @HenrikCarlqvist has in hist last two sentences. If you listen on port 22 on a device connected to the internet, you'll see continuous login attempts for users like root and admin. While listening on a different port obviously doesn't make that impossible, it means the scripts the script kiddies use won't work. My server listens on a different port and I monitor login attempts and I've never seen a login attempt that wasn't me. Also, disable root or any kind of privileged login, and if you can, disable password-based authentication completely.
    – blm
    Jan 2, 2016 at 18:11
  • I'll change the port from 22 to something else, use an encryption key and turn off root login on the server. Security is not my main concern right now, I'll tackle into that after :). However, the IP port forwarding I don't think I can do that through the router setup page. The Linux computer doesn't show up as being connected to the network because it is "behind" the Windows PC. Could you point me where I should look at for forwarding ports from the Windows machine? And how can I setup a static IP address on the ICS in win10?
    – matheo25
    Jan 2, 2016 at 19:18
  • Is there a compelling reason to have the Linux box behind the Windows box rather then in parallel with it - The windows box would make your life a LOT harder - and, with a properly set up firewall on the Linux box, would not offer any benefit.
    – davidgo
    Jan 2, 2016 at 20:04
  • the reason is that there is no wi-fi card on the Linux box and no possibility to plug it directly in the router (router is in another room, can't bring a cable from there to here).
    – matheo25
    Jan 2, 2016 at 21:53

1 Answer 1


Are you virtualizing your Ubuntu server on Windows, or is it on a separate machine? Ah, I see you mention ICS. Becomes harder. Try a search on 'windows ics nat'. Your alternative is to use something like VirtualBox on your windows machine, install ubuntu server as a virtual machine in VirtualBox, and then you can nat and/or bridge and/or port forward as needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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