5

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
  • 1
    I assume you reinstalled ssh on your server (192.168.1.6)? Please share it's configuration file. Oct 24, 2013 at 9:30
  • Can you test SSH locally on the server? eg ssh localhost
    – Oli
    Oct 24, 2013 at 9:36
  • This issue is solved now. perhaps by disabling firewall on both the machines. Also as suggested by Andrejs, I had to reinstall ssh on 192.168.1.6, I think I did not do this earlier. I was installing on the machine from which I was doing ssh
    – gpuguy
    Oct 24, 2013 at 9:41
  • @AndrejsCainikovs though the issue is solved , but can you tell me where do we get that configuration file?
    – gpuguy
    Oct 24, 2013 at 9:43
  • SSH server configuration file is located at /etc/ssh/sshd_config. Please answer your own question and mark it as solved later on. Oct 24, 2013 at 9:57

3 Answers 3

4

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
[email protected]'s password: 
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.8.0-29-generic i686)

 * Documentation:  https://help.ubuntu.com/

131 packages can be updated.
67 updates are security updates.

Last login: Thu Oct 24 15:18:34 2013 from ubuntu.local
2

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
1

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 [email protected]' 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.

You must log in to answer this question.

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