Ssh connection refused (causes & solutions)

Change in public keys after reinstall

The SSH service generates a unique public key for each system. This is done so clients connecting to a system have a way to make sure that they’re connecting to the intended server.

For example, what if the server you usually connect to has switched IP addresses? You don’t want to type your login information into the wrong system that has assumed the former IP address.

If a situation like this occurs, your SSH client should warn you that the public keys have changed. The $HOME/.ssh path contains all the keys from the hosts your system has connected to before. You can check out the known_hosts file like this:

$ cat ~/.ssh/known_hosts

There’s only one host in our file, but even that just looks like gibberish to us. Rather than editing this file ourselves, it’s better to use the ssh-keygen command to remove a particular host key from the file.

$ ssh-keygen -r x.x.x.x

Or

$ ssh-keygen -r example.com

Use either the IP address or the hostname of the server. In our example, the key in our file is just from localhost, so we remove it like so:

What Is SSH and When Should I Use It?

Secure Shell (SSH), also sometimes called Secure Socket Shell, is a protocol for securely accessing your site’s server over an unsecured network. In other words, it’s a way to safely log in to your server remotely using your preferred command-line interface:

Using SSH to remotely access a WordPress site hosted on Kinsta

Unlike File Transfer Protocol (FTP), which only enables you to upload, delete, and edit files on your server, SSH can accomplish a wide range of tasks. For instance, if an error locks you out of your WordPress site, you can use SSH to access it remotely.

This protocol also enables you to use several key developer tools, including:

  • WP-CLI. The WordPress command line. You can use it for a variety of tasks, including new installations, bulk plugin updates, and media file imports.
  • Composer. A PHP package manager. It enables you to implement several frameworks for use in your site’s code by pulling the necessary libraries and dependencies.
  • Git. A version control system used to track changes in code. This is especially useful for teams of developers working together on a single project.
  • npm. A JavaScript package manager. It includes a command-line and JavaScript software registry. Note: Kinsta customers will need an Enterprise plan in order to access this feature.

It’s important to note that using SSH is an advanced skill. Generally speaking, lay users of WordPress should contact their developers or hosting providers for help, rather than trying to resolve issues with SSH themselves.

Important

A simple mistyped command could ruin your website, so it’s vital that you know what you’re doing.

Суть и причины дисфункции

Полная версия текста данной ошибки звучит как «Error: connection refused», что в переводе означает «Ошибка: соединение отвергнуто». Данная ошибка возникает в стационарном и мобильном браузере Хром (в статистическом большинстве случаев), а также на альтернативных браузерах (значительно реже).

Причины её возникновения могут быть следующими:

  • Наблюдаются проблемы в работе вашего интернет-провайдера (ISP);
  • Имеются проблемы в работе конкретного сайта (или на нём проводятся технические работы);
  • Вы используете прокси (VPN) для доступа к сайту, при этом указанный прокси (VPN) работает некорректно;
  • На вашем компьютере используются неверные настройки интернет-соединения;
  • Доступ к сайту блокирует какой-либо зловред;
  • Доступ к необходимому сайту блокируют антивирус или брандмауэр;
  • Наблюдаются проблемы в работе вашего роутера (модема);
  • Доступ к сайту блокируют разнообразные расширения (дополнения) установленные в вашем браузере;
  • Вы используете устаревшую версию браузера.

Root login if disabled and how to enable it

For security reasons, Linux almost never wants you to do anything as root by default. When possible, you’re supposed to use an account with fewer permissions and only elevate to root when necessary.

Well, this is recommended in very very few situations, and sometimes you may want to just log in straight to root. SSH is configured by default to deny root logins.

If you’re trying to login to a system as root and you haven’t done any configurations to allow this, you’re only going to be able to get in by using a normal user account.

You can configure your SSH server to allow root logins by editing the sshd_config file. Use nano, vi, or your other favorite text editor to open the file here:

$ sudo vi /etc/ssh/sshd_config

Scroll down this file until you see PermitRootLogin.

On our Ubuntu installation, PermitRootLogin is, by default, set to “prohibit-password”. This means that we can log in as root via key authentication, but not by supplying the root password.

On some systems, you may see it just say “no”, which means that root logins of any authentication method are not allowed.

To allow the root user to login via SSH, you can change this line to say yes. Make sure that you remove the # at the beginning so it’s no longer commented out. It would need to look like this in order to allow root logins:

Whenever you make changes to this file, you have to restart the SSH service for them to take effect:

$ sudo systemctl restart ssh

Warning: Please be sure that you have a very secure root password set before editing the SSH configuration file to allow root login with a password. There are bots constantly scanning the internet for servers to SSH into, and they will attempt to login to the root account more than any other.

This is why SSH is configured by default to not permit any kind of root login via password. We show in the next section how to see these connection attempts and show a real example of how attacks are constantly being executed against our live production server.

Option 2: Don’t try and circumvent workplace IT policy

RECOMMENDED

As an IT security professional myself, who has had to terminate network access due to policy violations of other individuals at a workplace in the past, my recommendation is that your girlfriend does not try and SSH to your shared server from a work environment/network. If there are any types of auditing being done on the network, then the network audits may show that someone is attempting to SSH to an unsecure, unvetted server. While you or your girlfriend may individually not have any malicious intent, most workplace «Network/Computer Acceptable Use Policies» will include that you will not be doing personal items on the network without authorization or absolute necessity. Another thing is likely to state «You shall not use certain services such as: «.

I would recommend that you review the acceptable use policy for the girlfriend’s workplace, and determine whether she would be violating this policy, enough so that she could be facing disciplinary action, such as removal of network access, removal of computer access, or potential dismissal. Do not try and circumvent the policy because your girlfriend could be fired by circumventing it.

Что делать, если ни одно из этих решений не работает

Если ни одно из решений, с которыми мы ознакомились, не исправляет сообщение ERR_CONNECTION_REFUSED, это, как правило, признак того, что что-то более серьезное пошло не так на стороне сервера (другими словами, на самом сайте).

К сожалению, в этом случае единственное, что вы можете сделать, это набраться терпения. Вероятно, владельцы веб-сайта прилагают все усилия, чтобы решить возникшие проблемы, и вскоре они возобновят свою деятельность в обычном режиме.

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

Объясните проблему, с которой вы столкнулись, и отметьте, что вы пробовали несколько решений, которые не дали результата. Надеемся, что команда, стоящая за веб-сайтом, ответит вам и раскажет о лучшем порядке действий. Вы можете даже оказать им услугу, если вам случится сообщить им о проблеме, о которой они не знали, которая препятствовала доступу к их сайту.

Summary

Being able to connect to your server with SSH is convenient in a wide range of situations. It can enable you to access your site when you’re locked out of your WordPress dashboard, run commands via WP-CLI, track changes in your site’s code with Git, and more.

Although there are several causes that could be behind your SSH connectivity error, these are a few of the most common:

  1. Your SSH service is down.
  2. You have the wrong credentials.
  3. The port you’re trying to use is closed.
  4. SSH isn’t installed on your server.
  5. Firewall settings are preventing an SSH connection.

If you enjoyed this tutorial, then you’ll love our support. All Kinsta’s hosting plans include 24/7 support from our veteran WordPress developers and engineers. Chat with the same team that backs our Fortune 500 clients. Check out our plans

Проверьте настройки Брандмауэра

Иногда встроенный брандмауэр или антивирусная программа блокирует веб-ресурсы. В качестве решения err connection refused предлагаю отключить брандмауэр и антивирус или добавить нужный сайт в список исключений из проверки.

  1. С помощью «Win+S» запустите строку поиска и введите «брандмауэр».
  2. В левом меню переместитесь в раздел «Включение и отключение брандмауэра».
  3. Отключите все имеющиеся опции.

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

Также некоторые антивирусы, такие как Dr Web, умеют анализировать зашифрованные соединения (сайты, использующие протокол HTTPS). Поэтому если некоторые ресурсы не открываются, проверьте этот момент, активируйте или наоборот деактивируйте эту опцию.

Не удалось устранить проблему?Обратитесь за помощью к специалисту!

Connection timed out: no further information – особенности дисфункции

В переводе текст данного сообщения звучит примерно как «Сетевой сбой Java. Время соединения истекло: дальнейшая информация отсутствует».

Указанная ошибка Java.net.ConnectException обычно возникает во время подключения к серверу игры «Майнкрафт», но также фиксировались спорадические случаи появления данной ошибки при работе других продуктов, использующих «Java» (к примеру, на «Azure notification hub»).

Появление проблемы «Java.net.ConnectException: Connection timed out: no further information» имеет следующие причины:

  • Пользователь использует нестабильное сетевое соединение с медленным интернетом;
  • На ПК пользователя установлена устаревшая версия «Java»;
  • Пользователь пользуется устаревшей версией «Майнкрафт»;
  • Наблюдаются сбои в работе игрового сервера, к которому пробует подключиться пользователь (ресурс не доступен, проходят технические работы и др.);
  • Антивирус или брандмауэр блокирует подключения к игровому серверу;
  • Пользователь использует динамический IP;
  • Пользовательский роутер работает некорректно.
Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Adblock
detector