Unable to SSH into Ubuntu Server? Fix it Now!

If your Ubuntu server is not allowing SSH connections, there could be several possible reasons. Below are common issues and their solutions:

Unable to SSH into Ubuntu server. What could be the possible causes?

Install SSH:

       sudo apt-get install openssh-server

1. SSH Service Not Running

 Check if SSH is installed and running

 sudo systemctl status ssh

If it’s not running, start it:

sudo systemctl start ssh

Enable it to start on boot

sudo systemctl enable ssh

2. SSH Port is Blocked by Firewall

      Check UFW (Uncomplicated Firewall).

          sudo ufw status

       If SSH is blocked, allow it:

       sudo ufw allow ssh

       Restart UFW:

          sudo ufw reload

3. Incorrect SSH Configuration

    Check SSH Configuration File

sudo nano /etc/ssh/sshd_config

Ensure these lines are correctly set:

 Port 22    # Or a different port if you changed it

 PermitRootLogin yes     # Only if root login is needed

 PasswordAuthentication yes     # If using password-based authentication

Restart SSH service after changes:

sudo systemctl restart ssh

4. IP Blocking (Fail2Ban or Hosts Deny)

Check if Fail2Ban is blocking SSH

  sudo fail2ban-client status sshd

If blocked, unban your IP:

sudo fail2ban-client set sshd unbanip <your-ip>

        Check /etc/hosts.deny

          cat /etc/hosts.deny

               Remove any lines blocking SSH.

5. Network Issues

    Check if SSH Port is Open

    From another machine, run:

        nc -zv <server-ip> 22

       If port 22 is closed, check

Cloud firewall settings (e.g., AWS Security Groups, Azure NSG, etc.)

Router or NAT settings if accessing from outside.

6. Incorrect User Permissions

     Ensure the user’s home directory and SSH keys have correct permissions

        chmod 700 ~/.ssh

       chmod 600 ~/.ssh/authorized_keys

7. Private Key Issues (For Key-Based Authentication)

     If using key-based login, ensure:

     The correct key is in ~/.ssh/authorized_keys on the server.

    You are using the right private key:

  ssh -i /path/to/private_key user@server-ip

       The key format is correct (e.g., OpenSSH).

8. Disk Space Issues

  If the server is out of space, SSH may fail.

     df -h

 If full, free up space:

  sudo apt autoremove

 sudo rm -rf /var/log/*

9. Wrong Host or IP

Ensure the server’s public or private IP hasn’t changed.

Run ip a on the server to check assigned IPs.

Get Free Website Hosting Migration & Enjoy 65% Off on Our Yearly Hosting Plans

For more info Contact to sales team


Scroll to Top