Problem Statement

Can't connect to a Linux server(Debian Flavour) via SSH.

Error Message

Connection refused



Solution

There were unknown changes made in /etc/ssh/ssh_config file. To fix this issue, we had installed OpenSSH server following below mentioned steps:
  1. Logged into VPS through console and fired following commands:

    sudo apt-get purge openssh-server
    mv /etc/ssh /etc/ssh_old
    created new ssh directory in /etc
    sudo apt-get install openssh-server​
  2. Try ssh after performing above steps. If you get "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED", rename the known_hosts from .ssh/ in your local machine and try again.