Connnect to Linux from Windows using PuTTY over the Internet

11,934

Solution 1

I want to connect Linux from Windows using putty, over the Internet. I have tried this on Windows 7 and Linux and VirtualBox, but it shows “connection refused.”

This has nothing to do with Windows, Linux or anything. It’s all a networking issue. If you want to do what you describe you need to make sure your Internet connection allows network connections from the outside world. And the two major things you need to check is:

  • Can you ping the remote host?
  • Is SSH port 22 open on the remote host?

1. Check if you can ping the remote host.

If you have access to a system outside of the system, then you should do the following checks. First, can you ping the host’s IP address from outside like this; using 123.456.789.0 as an example:

ping 123.456.789.0

If you don’t get the pings returned, then you have your problem right there. If you get a response back, that’s good.

2. Check if port 22 is open on the remote host.

Now check if the SSH port is open by using nmap like this; again using 123.456.789.0 as an example:

nmap 123.456.789.0 -p 22

The output should be something like this if it’s open:

Starting Nmap 6.25 ( http://nmap.org ) at 2014-10-23 09:46 EDT
Nmap scan report for 123.456.789.0 (123.456.789.0)
Host is up (0.15s latency).
PORT   STATE SERVICE
22/tcp open  ssh

If either of those fail, you will not be able to connect to the remote host. How to solve depends on your host machine network setup. If you have a router with a firewall in it you might need to open up port 22 and/or map all networking from port 22 on the router to your machine. But it’s all idiosyncratic to your setup so we can’t really provide a step-by-step for that. These are just the basic concepts.

Solution 2

You need to port forward the SSH port to the internal address of your Linux machine. The default port is 22. Also, you need to make sure that you allow every IP in your sshd_config file.

Solution 3

If you are getting the error for connection refused this means you donot have Open-ssh server configured on your linux machine so as to accept request from client machine

For debain user's command is

sudo apt install openssh-server

refer_here_for_more

Share:
11,934

Related videos on Youtube

Vaibhav Khandekar
Author by

Vaibhav Khandekar

Updated on September 18, 2022

Comments

  • Vaibhav Khandekar
    Vaibhav Khandekar almost 2 years

    I want to connect to Linux from Windows using PuTTY, over the Internet. This will give my friends access to execute shell script files on my Linux (Ubuntu). I have tried this on Windows 7 and Linux and VirtualBox, but it shows: connection refused.

  • Kinnectus
    Kinnectus over 9 years
    +1. The clue is in the error. Connection refused is not connection failed or other messages (port forwarding etc.). The crucial part is ensuring your friends' IP's are allowed and any user account they've been given is allowed.
  • mckenzm
    mckenzm about 4 years
    +1 First (only ?) response to mention actually running an SSH server.