0

Hello people of this community, I purchase a vpn and when tried to connect through ssh i got the error "connection timed out" every time I try to connect using putty. on a remote desktop I can.

I have read might be something related to firewall, I did the following "disable firewall or add the .exe file to firewall exceptions" I tried both and the error continues.

edit: im trying to connect from my pc using windows 10 and my vps is on ubuntu

Any other solution?

2
  • 1
    From where to where exactly are you trying to connect? Please edit your question.
    – Albin
    Commented Nov 24, 2023 at 14:06
  • We will need details on your network and VPN setup, what you're connecting from and to, and other info as well. Edit your question to make it more clear. Commented Nov 24, 2023 at 21:00

1 Answer 1

1

"Connection timed out" usually indicates some firewall is blocking the connection. Assuming your VPN provides an unrestricted network path between the PCs, it might be located:

  • on your local system (but if you have added putty.exe to firewall exceptions, this should not be the problem)
  • on the remote system (note that on the remote system, you must allow the SSH server process, not putty.exe - PuTTY is just a client)

Windows systems also won't necessarily include a SSH server by default: in PowerShell, run:

Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Server*'

to see if a SSH server is installed, and

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

to install it if necessary.

After installing the SSH server, you must also start it and configure it to start automatically at boot. That can be done with these PowerShell commands:

Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'

Here's a PowerShell snippet for configuring Windows Firewall to accept incoming SSH connections (you may need to run this on the remote PC):

if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
    Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
    New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
    Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}

You must log in to answer this question.

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