Jump to content

Reverse SSH with Ubuntu and Windows


Recommended Posts

After googling I found out that this question is documented, but even after using the same code I can't get it to work (maybe because I used ssh yesterday for the first time).

I want to connect to a virtual Windows XP machine with my ubuntu machine.

I installed the openssh-server on ubuntu, forwarded the port 22 on my router and created a dyndns hostname.

On the Windows XP machine, I'm using PuTTy.

So, Ubuntu is the server, and Windows the client.

I want Windows (PuTTy) to connect to Ubuntu (ssh-server) and create a tunnel so I can use this connection to execute some shell commands. So here's what I tried:

Executed code - Windows (plink is the command line tool of putty)

plink.exe -R -N 2048:localhost:22 username.of.ubuntu@hostname.of.ubuntu

I get an connection, enter my username and password of my ubuntu machine.

Executed code - Ubuntu

ssh -p 2048 username.of.windows@localhost

I get an "ssh_exchange_identification: Connection closed by remote host

" error ? I added "sshd : ALL" to /etc/hosts.allow, but it doesn't seem to help.

Hmm, does anyone has a solution, and, is it actually possible to have a windows shell under linux/ubuntu?

Link to comment
Share on other sites

In which case you don't need to (and shouldn't) setup port farwarding on the router. This is for creating a connection form the Internet to a local computer.

Insted of using

plink.exe -R -N 2048:localhost:22 username.of.ubuntu@hostname.of.ubuntu


plink.exe -R -N 2048:localhost:22 username.of.ubuntu@[color=red]IP Address[/color].of.ubuntu


What software are you using to host the VM (VMware, Xen, Virtual Box)?

Link to comment
Share on other sites

I'm scripting a kind of one-click-vnc-with-nice-little-buttons-and-graphics for relatives, friends and other not very computer interested persons. I want ssh to tunnel the vnc traffic and create a remote shell (like netcat, only via ssh), so I simulate the existence of the internet in my scenario (vm).

I tried it but I get the same error.

I use virtualbox.


Uhm, obvious: if nothing is listening, nothing can be established. Problem solved by installing openssh on the client machine.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...