Ping works , but unable to do ssh

I disabled the firewall with sudo ufw disable, I can ping the server, the server can ping me but I can't ssh to it:

root@ubuntu:/home/acme# ssh 192.168.1.6 ssh: connect to host
192.168.1.6 port 22: Connection refused

I removed ssh and reinstalled :

sudo apt-get remove openssh-client openssh-server
sudo apt-get install openssh-client openssh-server

But still ssh is not working and I get the error

connection refused

How do I tackle this issue?

Here are some other stuff I have tried so far:

root@ubuntu:/home/acme# sudo service ssh start
start: Job is already running: ssh
root@ubuntu:/home/acme# ps aux | grep ssh
acme 6548 0.0 0.0 12576 320 ? Ss 04:09 0:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session --session=ubuntu
root 22219 0.0 0.1 50040 2852 ? Ss 05:10 0:00 /usr/sbin/sshd -D
root 22277 0.0 0.0 8116 896 pts/0 S+ 05:17 0:00 grep --color=auto ssh

Update for future visitors

removing and reinstalling ssh on the server worked for me :

sudo apt-get remove openssh-client openssh-server
sudo apt-get install openssh-client openssh-server
5

3 Answers

Removing and reinstalling ssh on the server worked for me :

My master node is : 192.168.1.6

My client is: 192.168.1.4

On the master I did this:

sudo apt-get remove openssh-client openssh-server
sudo apt-get install openssh-client openssh-server

Now from my client I did this:

root@ubuntu:/home# ssh 192.168.1.6
root@192.168.1.6's password:
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.8.0-29-generic i686) * Documentation:
131 packages can be updated.
67 updates are security updates.
Last login: Thu Oct 24 15:18:34 2013 from ubuntu.local

Kind of a weird shot-in-the-dark, but make sure your IP didn't change. I had this issue once - I set a .bashrc alias alias sshdev='ssh me@123.2.3.4' as my typical way of logging in, and one day I started getting the following error:

ME-M-216C:~ me$ sshdev
ssh: connect to host 123.2.3.4 port 22: Connection refused

We just had a power outage at work which reset the IP's, so I was successfully pinging the 123.2.3.4 IP but it wasn't the correct machine. You can use nslookup <IP> to make sure it's the correct machine name that you're trying to ssh into.

This happens in UBUNTU because, by default only openssh-client is present. To access ur remote Ubuntu, you'll never ssh server running in remote machine. Just install server.

sudo apt install openssh-server

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like