Ошибка ssh connection refused

I have an Ubuntu Server 10.10 32-bit in my home. I’m making SSH connections to it from my PC via Putty.

The problem is, sometimes I’m able to login seamlessly. However, sometimes it gives me an error like this: Network error: Connection refused.

Then, I dont’t change anything, try to login a few times more, wait a while and try again. Sometimes I can log in, sometimes I cannot. It seems pretty random to me.

What can I do to solve this?

Edit:

And Sometimes, Putty gives Network error: Software caused connection abort error after displaying login as: text.

Here is the ping -t output:

Pinging 192.168.2.254 with 32 bytes of data:
Reply from 192.168.2.254: bytes=32 time=6ms TTL=64
Reply from 192.168.2.254: bytes=32 time=65ms TTL=6
Reply from 192.168.2.254: bytes=32 time=88ms TTL=6
Reply from 192.168.2.254: bytes=32 time=1ms TTL=64
Reply from 192.168.2.254: bytes=32 time=3ms TTL=64
Reply from 192.168.2.254: bytes=32 time=1ms TTL=64
Reply from 192.168.2.254: bytes=32 time=1ms TTL=64
Reply from 192.168.2.254: bytes=32 time=1ms TTL=64
Reply from 192.168.2.254: bytes=32 time=1ms TTL=64

I turned off firewall of router, and everything seems to work now. Except for that, I still can’t enter my web server by typing external IP from my PC.

I have an Ubuntu Server 10.10 32-bit in my home. I’m making SSH connections to it from my PC via Putty.

The problem is, sometimes I’m able to login seamlessly. However, sometimes it gives me an error like this: Network error: Connection refused.

Then, I dont’t change anything, try to login a few times more, wait a while and try again. Sometimes I can log in, sometimes I cannot. It seems pretty random to me.

What can I do to solve this?

Edit:

And Sometimes, Putty gives Network error: Software caused connection abort error after displaying login as: text.

Here is the ping -t output:

Pinging 192.168.2.254 with 32 bytes of data:
Reply from 192.168.2.254: bytes=32 time=6ms TTL=64
Reply from 192.168.2.254: bytes=32 time=65ms TTL=6
Reply from 192.168.2.254: bytes=32 time=88ms TTL=6
Reply from 192.168.2.254: bytes=32 time=1ms TTL=64
Reply from 192.168.2.254: bytes=32 time=3ms TTL=64
Reply from 192.168.2.254: bytes=32 time=1ms TTL=64
Reply from 192.168.2.254: bytes=32 time=1ms TTL=64
Reply from 192.168.2.254: bytes=32 time=1ms TTL=64
Reply from 192.168.2.254: bytes=32 time=1ms TTL=64

I turned off firewall of router, and everything seems to work now. Except for that, I still can’t enter my web server by typing external IP from my PC.

25 мая, 2017 11:40 дп
93 893 views
| Комментариев нет

Linux, SSH

В первой статье этой серии вы узнали о том, как и в каких ситуациях вы можете попробовать исправить ошибки SSH. Остальные статьи расскажут, как определить и устранить ошибки:

  • Ошибки протокола: в этой статье вы узнаете, что делать, если сбрасываются клиентские соединения, клиент жалуется на шифрование или возникают проблемы с неизвестным или измененным удаленным хостом.
  • Ошибки аутентификации: поможет устранить проблемы с парольной аутентификацией или сбросом SSH-ключей.
  • Ошибки оболочки: это руководство поможет исправить ошибки ветвления процессов, валидации оболочки и доступа к домашнему каталогу.

Для взаимодействия SSH-клиента с SSH-сервером необходимо установить базовое сетевое подключение. Это руководство поможет определить некоторые общие ошибки подключения, исправить их и предотвратить их возникновение в будущем.

Требования

  • Убедитесь, что можете подключиться к виртуальному серверу через консоль.
  • Проверьте панель на предмет текущих проблем, влияющих на работу и состояние сервера и гипервизора.

Основные ошибки

Разрешение имени хоста

Большинство ошибок подключения возникает тогда, когда ссылка на хост SSH не может быть сопоставлена с сетевым адресом. Это почти всегда связано с DNS, но первопричина часто бывает не связана с DNS.

На клиенте OpenSSH эта команда:

ssh user@example.com

может выдать ошибку:

ssh: Could not resolve hostname example.com: Name or service not known

В PuTTY может появиться такая ошибка:

Unable to open connection to example.com Host does not exist

Чтобы устранить эту ошибку, можно попробовать следующее:

  • Проверьте правильность написания имени хоста.
  • Убедитесь, что вы можете разрешить имя хоста на клиентской машине с помощью команды ping. Обратитесь к сторонним сайтам (WhatsMyDns.net, например), чтобы подтвердить результаты.

Если у вас возникают проблемы с разрешением DNS на любом уровне, в качестве промежуточного решения можно использовать IP-адрес сервера, например:

ssh user@111.111.111.111
# вместо
ssh user@example.com.

Истечение времени соединения

Эта ошибка значит, что клиент попытался установить соединение с SSH-сервером, но сервер не смог ответить в течение заданного периода ожидания.

На клиенте OpenSSH следующая команда:

ssh user@111.111.111.111

выдаст такую ошибку:

ssh: connect to host 111.111.111.111 port 22: Connection timed out

В PuTTY ошибка выглядит так:

Network error: Connection timed out

Чтобы исправить ошибку:

  • Убедитесь, что IP-адрес хоста указан правильно.
  • Убедитесь, что сеть поддерживает подключение через используемый порт SSH. Некоторые публичные сети могут блокировать порт 22 или пользовательские SSH-порты. Чтобы проверить работу порта, можно, например, попробовать подключиться к другим хостам через этот же порт. Это поможет вам определить, не связана ли проблема с самим сервером.
  • Проверьте правила брандмауэра. Убедитесь, что политика по умолчанию – не DROP.

Отказ в соединении

Эта ошибка означает, что запрос передается на хост SSH, но хост не может успешно принять запрос.

На клиенте OpenSSH следующая команда выдаст ошибку:

ssh user@111.111.111.111
ssh: connect to host 111.111.111.111 port 22: Connection refused

В PuTTY ошибка появится в диалоговом окне:

Network error: Connection refused

Эта ошибка имеет общие с ошибкой Connection Timeout причины. Чтобы исправить её, можно сделать следующее:

  • Убедиться, что IP-адрес хоста указан правильно.
  • Убедиться, что сеть поддерживает подключение через используемый порт SSH. Некоторые публичные сети могут блокировать порт 22 или пользовательские SSH-порты. Чтобы проверить работу порта, можно, например, попробовать подключиться к другим хостам через этот же порт.
  • Проверить правила брандмауэра. Убедитесь, что политика по умолчанию – не DROP, и что брандмауэр не блокирует этот порт.
  • Убедиться, что сервис запущен и привязан к требуемому порту.

Рекомендации по исправлению ошибок подключения

Брандмауэр

Иногда проблемы с подключением возникают из-за брандмауэра. Он может блокировать отдельные порты или сервисы.

Читайте также: Что такое брандмауэр и как он работает?

В разных дистрибутивах используются разные брандмауэры. Вы должны научиться изменять правила и политики своего брандмауэра. В Ubuntu обычно используется UFW, в CentOS – FirewallD. Брандмауэр iptables используется независимо от системы.

Читайте также:

  • Основы UFW: общие правила и команды фаервола
  • Настройка брандмауэра FirewallD в CentOS 7
  • Основы Iptables: общие правила и команды брандмауэра

Чтобы настроить брандмауэр, нужно знать порт сервиса SSH. По умолчанию это порт 22.

Чтобы запросить список правил iptables, введите:

iptables -nL

Такой вывод сообщает, что правил, блокирующих SSH, нет:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Если в выводе вы видите правило или политику по умолчанию REJECT или DROP, убедитесь, что цепочка INPUT разрешает доступ к порту SSH.

Чтобы запросить список правил FirewallD, введите:

firewall-cmd --list-services

Список, появившийся на экране, содержит все сервисы, которые поддерживаются брандмауэром. В списке должно быть правило:

dhcpv6-client http ssh

Если вы настроили пользовательский порт SSH, используйте опцию –list-ports. Если вы создали пользовательское определение сервиса, добавьте опцию –list-services, чтобы найти SSH.

Чтобы проверить состояние UFW, введите:

ufw status

Команда вернёт доступные порты:

Status: active
To                         Action      From
--                         ------      ----
22                         LIMIT       Anywhere
443                        ALLOW       Anywhere
80                         ALLOW       Anywhere
Anywhere                   ALLOW       192.168.0.0
22 (v6)                    LIMIT       Anywhere (v6)
443 (v6)                   ALLOW       Anywhere (v6)
80 (v6)                    ALLOW       Anywhere (v6)

В списке должен быть порт SSH.

Проверка состояния сервиса SSH

Если вы не можете подключиться к серверу по SSH, убедитесь, что сервис SSH запущен. Способ сделать это зависит от операционной системы сервера. В более старых версиях дистрибутивов (Ubuntu 14.04, CentOS 6, Debian 8) используется команда service. Современные дистрибутивы на основе Systemd используют команду systemctl.

Метод проверки состояния сервиса может варьироваться от системы к системе. В более старых версиях (Ubuntu 14 и ниже, CentOS 6, Debian 6) используется команда service, поддерживаемая системой инициализации Upstart, а в более современных дистрибутивах для управления сервисом используется команда systemctl.

Примечание: В дистрибутивах Red Hat (CentOS и Fedora) сервис называется sshd, а в Debian и Ubuntu – ssh.

В более старых версия используйте команду:

service ssh status

Если процесс работает должным образом, вы увидите вывод, который содержит PID:

ssh start/running, process 1262

Если сервис не работает, вы увидите:

ssh stop/waiting

В системах на основе SystemD используйте:

systemctl status sshd

В выводе должна быть строка active:

sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
Active: active (running) since Mon 2017-03-20 11:00:22 EDT; 1 months 1 days ago
Process: 899 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0/SUCCESS)
Main PID: 906 (sshd)
CGroup: /system.slice/sshd.service
├─  906 /usr/sbin/sshd -D
├─26941 sshd: [accepted]
└─26942 sshd: [net]

Если сервис не работает, вы увидите в выводе inactive:

sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
Active: inactive (dead) since Fri 2017-04-21 08:36:13 EDT; 2s ago
Process: 906 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=0/SUCCESS)
Process: 899 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0/SUCCESS)
Main PID: 906 (code=exited, status=0/SUCCESS)

Чтобы перезапустить сервис, введите соответственно:

service ssh start
systemctl start sshd

Проверка порта SSH

Существует два основных способа проверить порт SSH: проверить конфигурационный файл SSH или просмотреть запущенный процесс.

Как правило, конфигурационный файл SSH хранится в /etc/ssh/sshd_config. Стандартный порт 22 может переопределяться любой строкой в этом файле, определяющей директиву Port.

Запустите поиск по файлу с помощью команды:

grep Port /etc/ssh/sshd_config

Читайте также: Использование Grep и регулярных выражений для поиска текстовых шаблонов в Linux

Команда вернёт:

Port 22

Если вы уже убедились, что сервис работает, теперь вы можете узнать, работает ли он на требуемом порте. Для этого используйте команду ss. Команда netstat –plnt выдаст аналогичный результат, но команду ss рекомендуется использовать для запроса информации сокета из ядра.

ss -plnt

В выводе должно быть указано имя программы и порт, который она прослушивает. Например, следующий вывод сообщает, что сервис SSH прослушивает все интерфейсы и порт 22.

State       Recv-Q Send-Q              Local Address:Port                       Peer Address:Port
LISTEN      0      128                 *:22                                     *:*                   users:(("sshd",pid=1493,fd=3))
LISTEN      0      128                 :::22                                    :::*                  users:(("sshd",pid=1493,fd=4))

Символ * и 0.0.0.0 указывает, что все интерфейсы сервера прослушиваются. Строка 127.0.0.1 значит, что сервис не является общедоступным. В sshd_config директива ListenAddress должна быть закомментирована, чтобы прослушивать все интерфейсы, или должна содержать внешний IP-адрес сервера.

Если у вас не получается самостоятельно настроить соединение SSH, вы можете обратиться за помощью к службе поддержки своего хостинг-провайдера.

Tags: firewalld, Iptables, OpenSSH, PuTTY, SSH, UFW

OpenSSH is an open-source version of the Secure Shell (SSH) protocol that can be used to login remotely to a server and to control remote Linux-based systems.

OpenSSH provides secure encrypted communication between two untrusted hosts over an insecure network.

OpenSSH also provides sftp and sftp-server that implement an easier solution for file-transfer and is used in major network monitoring tools and web servers all around the world.

In this tutorial, we will show you how to troubleshoot “the SSH Connection Refused” error while connecting to Ubuntu/Linux.

Connecting to a Server Via SSH

There are two ways to connect to a server via SSH. You can either use SSH command or Putty (or any other SSH Client for that matter) to connect a server.

Connect to a Server with SSH command

The basic syntax of the SSH command is shown below:

ssh Username@Server-ip-address -p Port

Where:

  • Username : user account on your server.
  • Server-ip-address : IP address or Domain name of your server.
  • Port : It is the port number of the OpenSSH server, usually 22, unless you’ve changed it.

For example, let’s connect a remote server with username vyom, IP address 192.168.0.102 and Port number 22:

ssh vyom@192.168.0.102 -p 22

When your connecting your server via SSH for the first time, you should see the following message:

The authenticity of host '192.168.0.102 (192.168.0.102)' can't be established.
ECDSA key fingerprint is f7:9c:72:63:33:ac:d6:49:26:9c:af:c6:ff:11:27:01.
Are you sure you want to continue connecting (yes/no)? yes

Type yes and hit Enter, you will be asked to provide a password for user vyom. Provide a password and hit Enter to connect to a server. You should see the following output:

Welcome to Ubuntu 14.04.6 LTS (GNU/Linux 3.19.0-80-generic x86_64)
* Documentation: https://help.ubuntu.com/
Last login: Fri Nov 1 11:36:07 2019 from 192.168.0.102

You should see the above output in the following screen:

Connect a Server with Putty

Putty is open source SSH client software used to connect SSH server from Windows-based operating systems. You can download the Putty software from the Putty download page.

Once downloaded, double-click on the putty.exe program to launch the application. You should see the following screen:

Now, provide your SSH server IP-address, Port number, Connection type and click on the Open button to start the SSH session. If you are connecting to this server first time. You should see the following screen:

Click on the Accept button. You should see a terminal prompt asking for your username.

Provide your username, password and hit Enter to logged into your server.

Sometimes you receive an error like “Network error: Connection refused” while connecting to your server via SSH. There are a number of reasons for this error. In order to fix this error, you will need to identify the cause of the error by checking and ruling out each possibility. In this section, we will show you some troubleshooting steps to resolve this error.

Step 1

First, make sure the openssh-server package is installed on your server.

You can check it with the following command:

dpkg -l | grep openssh-server

If the openssh-server is installed, you should see the following output:

ii openssh-server 1:6.6p1-2ubuntu2.13 amd64 secure shell (SSH) server, for secure access from remote machines

If not installed, you can install it with the following command:

apt-get install openssh-server

Step 2

OpenSSH service uses sshd daemon to listen to the incoming connections and handles user authentication. If this service crashes, the connection fails and you will get the SSH Connection refused error.

You can check the status of OpenSSH service whether it is running or not with the following command:

/etc/init.d/ssh status

If it is running, you should see the following output:

ssh start/running, process 5476

You can also check the SSH service with the following command:

ps -ef | grep ssh

You should see the following output:

vyom 4651 4407 0 09:19 pts/0 00:00:00 ssh vyom@192.168.0.102 -p 22
root 4652 1 0 09:19 ? 00:00:00 sshd: vyom [priv]
vyom 4782 4652 0 09:20 ? 00:00:00 sshd: vyom@pts/18
root 5167 1 0 09:32 ? 00:00:00 sshd: vyom [priv]
vyom 5229 5167 0 09:33 ? 00:00:00 sshd: vyom@pts/27
root 5476 1 0 09:46 ? 00:00:00 /usr/sbin/sshd -D
vyom 5532 3678 0 09:50 pts/15 00:00:00 nano New/New/SSH/ssh
root 5584 5410 0 09:54 pts/18 00:00:00 grep --color=auto ssh

If an OpenSSH service is not running, you can start it with the following command:

/etc/init.d/ssh start

You should see the output of the above commands in the following screen:

Step 3

By default, OpenSSH is running on port 22 and is vulnerable to attack. Sometimes you’ll get the “Network error: Connection refused” error if your SSH server is listening on a different port.

First, you will need to find the open ports in your server with Nmap command:

nmap 192.168.0.102

You should see the following output:

Starting Nmap 6.40 ( http://nmap.org ) at 2019-12-05 10:03 IST
Nmap scan report for 192.168.0.102
Host is up (0.00016s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
2200/tcp open ici
7070/tcp open realserver
Nmap done: 1 IP address (1 host up) scanned in 2.09 seconds

In the above output, you should see that port 2200 and 7070 are open on your server.

Now, check which service is running on the given ports (2200, 7070) one by one:

nc -v -nn 192.168.0.102 2200

You should see that SSH service is running on port 2200:

Connection to 192.168.0.102 2200 port [tcp/*] succeeded!
SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.13

You can also check the OpenSSH listening port by opening the file:

/etc/ssh/sshd_config

You should now be able to connect to your OpenSSH server using the port 2200 as shown below:

ssh vyom@192.168.0.102 -p 2200

You should see the output of all the commands in the following screen:

Step 4

Some times you will get the “Network error: Connection refused” error, if your OpenSSH server IP address is conflict with other systems in your network.

You can use arp-scan tool to check the duplicate IP address in your network as shown below:

arp-scan 192.168.0.0/24

You should see the following output:

Interface: enp0s3, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.9 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.168.0.1 c8:3a:35:59:49:b0 Tenda Technology Co., Ltd.
192.168.0.102 4c:bb:58:9c:f5:55 (Unknown)
192.168.0.103 4c:bb:58:9c:f5:55 (Unknown)
192.168.0.104 4c:bb:58:9c:f5:55 (Unknown)
192.168.0.102 98:74:da:e5:6b:55 (Unknown) (DUP: 2)
10 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.9: 256 hosts scanned in 2.082 seconds (122.96 hosts/sec). 6 responded

To resolve this error, you will need to change your server’s IP address.

Step 5

Similarly, SSH connectivity problems may occur due to improper firewall configurations. If a firewall is configured to deny SSH connection on your server, the connectivity can fail and lead to the error SSH connection refused.

You can check whether your server is filtered with a firewall or not with the following command:

nmap 192.168.0.102

You should see that your server is filtered with a firewall:

Starting Nmap 6.40 ( http://nmap.org ) at 2019-12-05 10:14 IST
Nmap scan report for 192.168.0.102
Host is up (0.0012s latency).
All 1000 scanned ports on 192.168.0.102 are filtered
MAC Address: 08:00:27:29:E9:91 (Cadmus Computer Systems)
Nmap done: 1 IP address (1 host up) scanned in 23.57 seconds

To resolve this error, you will need to allow your SSH port through the firewall on your server.

Conclusion

In the above article, we learned how to troubleshoot the “SSH connection refused” error with several examples. I hope you have now enough knowledge to resolve this type of error.

While installing hadoop in my local machine , i got following error

ssh -vvv localhost 
OpenSSH_5.5p1, OpenSSL 1.0.0e-fips 6 Sep 2011 
debug1: Reading configuration data /etc/ssh/ssh_config    
debug1: Applying options for * 
debug2: ssh_connect: needpriv 0 
debug1: Connecting to localhost [127.0.0.1] port 22. 
debug1: connect to address 127.0.0.1 port 22: Connection refused 
ssh: connect to host localhost port 22: Connection refused

can some one help me to resolve this error , than changing port number

guntbert's user avatar

guntbert

5366 silver badges19 bronze badges

asked Jun 27, 2013 at 6:10

Surya's user avatar

If install Hadoop on Mac OSX, make sure turn on Remote Login under System Preferences then File Sharing. This worked on my machine.

Remote Login

answered Mar 7, 2014 at 16:15

vladof81's user avatar

vladof81vladof81

25.9k9 gold badges38 silver badges41 bronze badges

1

  1. Remove SSH with the following command:

    sudo apt-get remove openssh-client openssh-server
    
  2. Install SSH again with:

    sudo apt-get install openssh-client openssh-server
    

It will solve your problem.

Ronan Boiteau's user avatar

answered Aug 9, 2014 at 16:58

Divyang Shah's user avatar

Divyang ShahDivyang Shah

1,5781 gold badge11 silver badges22 bronze badges

12

Do you have sshd installed? You can verify that with:

which ssh
which sshd

For detailed information you can visit this link.

Ronan Boiteau's user avatar

answered Jun 27, 2013 at 6:27

Tariq's user avatar

TariqTariq

34k8 gold badges57 silver badges79 bronze badges

3

Try installing whole SSH package pack:

sudo apt-get install ssh

I had ssh command on my Ubuntu but got the error as you have. After full installation all was resolved.

Ronan Boiteau's user avatar

answered Apr 25, 2015 at 17:17

Michael Z's user avatar

Michael ZMichael Z

3,80310 gold badges42 silver badges57 bronze badges

3

I use a Mac, this worked for me:

Open System Preferences, then search for ‘sharing’.

Choose Remote Login, make sure it is on and remember to add required users.enter image description here

Got it from here

answered May 4, 2020 at 9:07

Dami's user avatar

DamiDami

6576 silver badges12 bronze badges

1

I did all the suggestion above and it did not work. Then I restart the ssh service and it works. This is what I do:

service sshd restart

Then I redo

ssh localhost

Now I can connect to my localhost. Hope it helps

rokejulianlockhart's user avatar

answered Jun 8, 2016 at 22:24

Arwan Khoiruddin's user avatar

1

Check if this port is open. Maybe your SSH demon is not running. See if sshd is running. If not, then start it.

Ronan Boiteau's user avatar

answered Jun 27, 2013 at 6:25

abhinav's user avatar

abhinavabhinav

1,24210 silver badges27 bronze badges

6

I used:

sudo service ssh start

Then:

ssh localhost

answered Apr 1, 2018 at 12:00

Linh's user avatar

LinhLinh

1632 silver badges8 bronze badges

0

If you restart service then it will work

$ service sshd restart

then check

$ ssh localhost

It will work

Boiethios's user avatar

Boiethios

37.6k18 gold badges133 silver badges182 bronze badges

answered Oct 19, 2016 at 10:49

Rushikesh's user avatar

RushikeshRushikesh

811 silver badge1 bronze badge

0

Make sure that /etc/hosts.allow contains:

ssh:ALL:allow
sshd:ALL:allow

OR

ssh:localhost:allow
sshd:localhost:allow

OR — some other variant

ssh:{host1,host2,host3...}:allow
sshd{host1,host2,host3...}:allow

INSURE that the first line in the file DOES NOT begin with ALL:ALL:DENY

NOTHING will be able to communicate with the host… on any port.

j0k's user avatar

j0k

22.5k28 gold badges79 silver badges89 bronze badges

answered Oct 4, 2013 at 18:30

Larry Helms's user avatar

1

For my case(ubuntu 14.04, fresh installed), I just run the following command and it works!

sudo apt-get install ssh

answered May 30, 2016 at 2:52

Shiqing Fan's user avatar

Shiqing FanShiqing Fan

6882 gold badges8 silver badges14 bronze badges

For what its worth I got the following error trying to ssh into my local machine, running Ubuntu 16.04 Xenial, from a vm.

 ssh: connect to host 192.168.144.18 port 22: Connection refused

It got immediately fixed with:

sudo apt-get install ssh

Take note, Before fix: ‘which sshd’ returned nothing and ‘which ssh’ returned

/usr/bin/ssh

And After the fix: ‘which sshd’ returned

/usr/sbin/sshd

answered May 31, 2017 at 10:23

IskandarG's user avatar

IskandarGIskandarG

3231 gold badge3 silver badges9 bronze badges

It might be caused by some of the following:

  1. SSH Server is not installed (only SSH Client), try: apt-get install ssh openssh-client openssh-server
  2. Connection is blocked by iptables (Firewall), try: ufw allow ssh

answered Jun 23, 2016 at 10:19

damian1baran's user avatar

damian1barandamian1baran

1,3071 gold badge14 silver badges13 bronze badges

1

On mac go to system settings->network->sharing and allow remote login.

try ssh localhost

You should be good.

answered Mar 3, 2017 at 16:16

user2498105's user avatar

What worked for me is:

sudo mkdir /var/run/sshd
sudo apt-get install --reinstall openssh-server

I tried all the above mentioned solutions but somehow this directory /var/run/sshd was still missing for me. I have Ubuntu 16.04.4 LTS. Hope my answer helps if someone has the same issue.
ubuntu sshxenial

answered Feb 21, 2019 at 17:48

Frida Schenker's user avatar

Frida SchenkerFrida Schenker

1,1891 gold badge9 silver badges14 bronze badges

  1. Before installing/reinstalling anything check the status of sshd . . .
sudo systemctl status sshd
  1. You should see something like . . .
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled; vendor prese>
   Active: inactive (dead)
     Docs: man:sshd(8)
           man:sshd_config(5)
  1. Just enable and start sshd
sudo systemctl enable sshd
sudo systemctl start sshd

answered Jul 30, 2020 at 1:04

0p3r4t0r's user avatar

0p3r4t0r0p3r4t0r

6135 silver badges12 bronze badges

1

Actually i solved this,
I just installed shh daemon.

in terminal :

sudo apt-get install openssh-server

answered Sep 25, 2016 at 17:04

User Learning's user avatar

User LearningUser Learning

3,1355 gold badges30 silver badges51 bronze badges

If you’re certain that you have installed ssh, then it’s possible that ssh and/or sshd has been terminated or the server service hasn’t been started. To check whether these processes are running use:

//this tells you whether your ssh instance is active/inactive
sudo service ssh status

OR

//this list all running processes whose names contain the string "ssh"
sudo ps -A | grep ssh

It’s likely that ssh would be active and running but sshd would not.
To enable them:

sudo service ssh start

NB;
— some systems have a restart option but mine didn’t

answered Mar 7, 2018 at 21:32

Kwaku Sarpong Manu's user avatar

try sudo vi /etc/ssh/sshd_config

in first few lies you’ll find

Package generated configuration file

See the sshd_config(5) manpage for details

What ports, IPs and protocols we listen for

Port xxxxx

change Port xxxxx to «Port 22» and exit vi by saving changes.

restart ssh sudo service ssh restart

answered Jun 2, 2020 at 9:33

Himanshu Singh's user avatar

My port number is different. i tried using

ssh localhost -p 8088

this worked for me

If you still face problems, try the following:

sudo ufw enable    
sudo apt-get install openssh-server

This might work too.

OhBeWise's user avatar

OhBeWise

5,3203 gold badges31 silver badges58 bronze badges

answered Jul 14, 2015 at 17:52

Dinesh's user avatar

A way to do is to go to terminal

$ sudo gedit /etc/hosts

***enter your ip address ipaddress of your pc  localhost 
    ipaddress of your pc  localhost(Edit your pc name with localhost) **

and again restart your ssh service using:

$ service ssh restart

Problem will be resolve.
Thanks

answered Jan 11, 2017 at 14:01

Sanyog Tiwari's user avatar

0

if you are using centOS or Red Hat, you should first update SElinux.
Execute the following statement

ausearch -c 'sshd' --raw | audit2allow -M my-sshd

then you need to execute

semodule -i my-sshd.pp

good luck

answered Nov 9, 2017 at 18:33

Berk CELEBI's user avatar

You may should edit your /etc/hosts. For example if my hostname is ub0, but the hostname in /etc/hosts is localhost, it may occur

connect to host ub0 port 22: Connection refused

Because the hostname in /etc/hosts is localhost not ub0.

So, you should be careful the hostname when building up distributed clusters.

answered Apr 28, 2016 at 9:43

GoingMyWay's user avatar

GoingMyWayGoingMyWay

16.7k31 gold badges95 silver badges147 bronze badges

For Linux:

  1. Remove SSH with the following command:

    sudo apt-get remove openssh-client openssh-server
    
  2. Install SSH again with:

    sudo apt-get install openssh-client openssh-server
    

finefoot's user avatar

finefoot

9,7247 gold badges57 silver badges96 bronze badges

answered Dec 16, 2018 at 22:11

Nehal Pawar's user avatar

you need to check the configuration in sshd_config ListenAddress 0.0.0.0 update this and restart the sshd service that will resolve the issue.

answered Jan 16, 2019 at 16:49

Rupeshrams's user avatar

Check file /etc/ssh/sshd_config for Port number. Make sure it is 22.

answered May 13, 2020 at 11:15

hiruna72's user avatar

What worked for me was modifying the ssh config file to the following:

Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa

answered Jan 13 at 11:59

Mariusz Szymoniak's user avatar

if youre apache server is not running your local host wont run check that out
there are some articles if you dont get it i will leave a link here ;)

check this

I had same error got it done rn

answered Nov 26, 2021 at 10:21

peqhv2's user avatar

1

  • Ошибка sse exe приложения 0xc000007b
  • Ошибка ss01000 на телевизоре
  • Ошибка ss01000 samsung телевизор
  • Ошибка srv008021 изменение платежного документа невозможно платежный документ выставлен
  • Ошибка srs хонда цивик ферио