- Исправляем ошибку: warning: remote host identification has changed!
- Описание ошибки
- Причина возникновения ошибки
- Как ее исправить
- WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
- Вариант 1
- Вариант 2
- English Query (запросы по теме на английском языке)
- Читайте также
- Добавить комментарий Отменить ответ
- Information Security Squad
- 🛠️ Исправление ошибки “WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED” на Linux
- Как исправить ошибку
- Ubuntu-ssh — — WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED [closed]
- 5 Answers 5
- ssh remote host identification has changed
- 31 Answers 31
Исправляем ошибку: warning: remote host identification has changed!
Данная ошибка может появляться при попытке подключения к другому компьютеру через ssh и sftp протоколы.
Описание ошибки
Полностью она выглядит так:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:5VLqurxCsGZoX78FWhcaEQkHwAtq+Xzp1tBfOxKQQzE.
Please contact your system administrator.
Add correct host key in /home/ajiekceu4/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/ajiekceu4/.ssh/known_hosts:5
remove with:
ssh-keygen -f «/home/ajiekceu4/.ssh/known_hosts» -R sysadmin.ru
ECDSA host key for sysadmin.ru has changed and you have requested strict checking.
Host key verification failed.
Причина возникновения ошибки
Как видно из описания, данная ошибка может появляться в том случае, когда на устройстве, к которому вы пытаетесь подключиться, изменился ключ и он не совпадает с тем ключом, который вы уже получали ранее, когда осуществляли подключение к этому устройству в предыдущие разы. Причины могут быть разные:
- Был изменен сертификат на устройстве и соответственно поменялся ECDSA ключ (из соображений безопасности, например);
- Переустановлена ОС на устройстве и соответственно изменился сертификат;
- Кто то пытается вас обмануть;
Как ее исправить
Если вы точно знаете, что сертификат на удаленном устройстве, к которому вы пытаетесь подключиться изменился и это не попытка вас обмануть со стороны заинтересованных лиц, то исправить эту ошибку очень просто. Необходимо просто удалить текущий ключ для данного домена (в нашем примере sysadmin.ru), сделать это можно командой, которая описана в самом тексте ошибки:
В случае успеха, вывод команды должен быть примерно таким:
После этого, необходимо еще раз попытаться подключиться к удаленному хосту и подтвердить установку нового ключа, написав «yes»
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
Ошибка возникающая при подключении на Mac OS к серверу по SSH в том случае, если сервер был переустановлен и изменил свою конфигурацию.
При первом подключении в операционной системе Mac OS к удалённому серверу сохраняется уникальный идентификатор ECDSA key fingerprint.
User_name$ ssh root@111.111.111.111
The authenticity of host ‘111.111.111.111 (111.111.111.111)’ can’t be established.
ECDSA key fingerprint is SHA256:JoLuu0OG8Fu5nAkyfsgFGHM347sN/FGsm37xnsGJS.
Are you sure you want to continue connecting (yes/no)? y
Please type ‘yes’ or ‘no’: yes
И если на стороне сервера меняется его конфигурация, то сохранённый fingerprint к этому ip адресу уже не подходит. При подключении через Терминал в Mac Os к серверу будет возникать ошибка следующего рода:
Для исправления ошибки нужно удалить fingerprint к этому ip адресу.
Вариант 1
Используем консольную команду:
вместо единичек надо указать свой адрес.
И fingerprint будет удален из файла known_hosts:
User_name$ ssh-keygen -R 111.111.111.111
# Host 111.111.111.111 found: line 5
/Users/User_name/.ssh/known_hosts updated.
Original contents retained as /Users/User_name/.ssh/known_hosts.old
Предыдущая версия файла known_hosts будет сохранена с именем known_hosts.old.
Вариант 2
Открыть файл через known_hosts:
И удалить там строку с нужным ip адресом.
После чего можно заново подключаться.
English Query (запросы по теме на английском языке)
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED
Someone could be eavesdropping on you right now
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY
Читайте также
На сайте отсутствует реклама! Значете почему?
Помогать людям — моё хобби. А навыки разработчика позволяют не парится нулевой монетизизацией этого сайта. Хотя.
Если вам помогла информация, то даже от доната в 40 рублей мне будет приятно. Докину немного, куплю латте в макдаке, вспомню за чей счет банкет и карма вам зачтется!
Но и просто оставленный комментарий благодарности ниже принесет мне улыбку радости 🙂
А если захочется написать всякие гадости с переходом на личности, да тоже не стесняйтесь, но обычно я отправляю такое в спам. Люблю, когда дома чисто.
Добавить комментарий Отменить ответ
Если возникнут вопросы пишите на электронную почту.
Information Security Squad
stay tune stay secure
- Home
- 2020
- Май
- 26
- 🛠️ Исправление ошибки “WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED” на Linux
🛠️ Исправление ошибки “WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED” на Linux
Сегодня я попытался подключиться по SSH к моему удаленному серверу Ubuntu 20.04 LTS и обнаружил следующее сообщение:
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED
На самом деле это не сообщение об ошибке.
Это просто уведомление о безопасности, которое указывает, что ключ хоста ECDSA для данной удаленной системы изменился с момента вашего последнего подключения.
Как вы, возможно, уже знаете, когда мы впервые обращаемся к удаленной системе из локальной системы через SSH, отпечаток ключа ECDSA, отправленный этим удаленным хостом, кэшируется и сохраняется в файле $ HOME/.ssh/known_hosts в нашей локальной системе .
Когда идентификатор (отпечаток) изменился после переустановки удаленной системы или назначения одного и того же IP-адреса для нескольких удаленных систем, появляется указанное выше предупреждение.
Как исправить ошибку
Чтобы устранить эту проблему, просто удалите кэшированный ключ для IP-адреса в локальной системе с помощью команды:
Вы также можете явно указать путь к файлу known_hosts с флагом -f, как показано ниже.
Приведенная выше команда удалит все ключи, принадлежащие удаленному хосту, из файла known_hosts локальной системы.
А также старое содержимое файла known_hosts будет сохранено в файле с именем «known_hosts.old».
Если вы используете другой порт SSH, вам нужно явно указать его, как показано ниже:
Здесь 1234 – номер порта SSH.
Замените его вашим фактическим номером порта SSH.
После удаления ключей попробуйте снова подключиться к SSH в удаленной системе с помощью команды:
Ubuntu-ssh — — WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED [closed]
Want to improve this question? Update the question so it’s on-topic for Stack Overflow.
Closed 6 years ago .
I’m unable to ssh and rysnc to a remote system. It keeps giving this error message:
I’ve removed authorized_keys file from /home/user/.ssh .
5 Answers 5
The message says » /root/.ssh/known_hosts » not authorized_keys. Remove that file (or at least the corresponding key) from it and you can go again! But be aware that: There must be a reason why the key changed. Was the system reinstalled? Make sure you check that or the whole idea of ssh is void.
BTW.: Is there a reason you ssh as root?
use the following command which removes the old keys from .ssh/known_hosts file
The message does explain itself:
- The remote host identified itself with a key
- Your previous copy of the key for that host is different
- So there is a chance that the remote host is not who they say they are
If you trust the remote host, you can delete line 8 from your /root/.ssh/known_hosts and ssh will ask you if it can add the new key next time you try to connect
If you don’t trust the remote host, you have to contact the host administrators to find out if and why they changed ssh keys. If they haven’t it means your traffic is being intercepted
On the other hand, if you really really trust the remote host (eg it is on an intranet), you can run ssh with
ssh remote host identification has changed
I’ve reinstalled my server and I am getting these messages:
I have tried various solutions that I found on the Internet. My known_hosts file (normally in
/.ssh/known_hosts ) is in /var/lib/sss/pubconf/known_hosts . I’ve tried to edit it, but it remains in one state. I have installed ipa-client and have Fedora 19. How do I resolve this warning?
All the answers answered so far work only if you do not have Freeipa installed.
The right answer for freeipa in comments below from adrin is here.
31 Answers 31
Here is the simplest solution
- -R hostname Removes all keys belonging to hostname from a known_hosts file. This option is useful to delete hashed hosts (see the -H option above).
/.ssh/known_hosts» – Nodeocrat Aug 15 ’17 at 9:04
Example with an ip address/hostname would be:
This will update the offending of your host from the known_hosts. You can also provide the path of the known_hosts with -f flag.
I had this same error occur after I recreated a Digital Ocean Ubuntu image. I used the following command with my server IP in place of [IP_ADDRESS]
When you reinstall the server its identity changes, and you’ll start to get this message. Ssh has no way of knowing whether you’ve changed the server it connects to, or a server-in-the-middle has been added to your network to sniff on all your communications — so it brings this to your attention.
Simply remove the key from known_hosts by deleting the relevant entry:
The 4d is on the account of Offending RSA . known_hosts:4
/.ssh directory and then delete it. Does your service keeps re-adding the keys after
/.ssh was blown away? – mockinterface Dec 30 ’13 at 13:10
The sledgehammer is to remove every known host in one fell swoop:
I come up against this as we use small subnets of short-lived servers from a jump box, and frequently have internal IP address reuse of servers that share the same ssh key.
The problem is that you’ve previously accepted an SSH connection to a remote computer and that remote computer’s digital fingerprint or SHA256 hash key has changed since you last connected. Thus when you try to SSH again or use github to pull code, which also uses SSH, you get an error. Why? Because you’re using the same remote computer address as before but the remote computer is responding with a different fingerprint. Therefore, it’s possible that someone is spoofing the computer you previously connected to. This is a security issue.
If you’re 100% sure that the remote computer isn’t compromised, hacked, being spoofed, etc then all you need to do is delete the entry in your known_hosts file for the remote computer. That will solve the issue as there will no longer be a mismatch with SHA256 fingerprint IDs when connecting.
On Mac here’s what I did:
1) Find the line of output that reads RSA host key for servername:port has changed and you have requested strict checking. You’ll need both the servername and potentially port from that log output.
2) Back up the SSH known hosts file cp /Users/yourmacusername/.ssh/known_hosts /Users/yourmacusername/.ssh/known_hosts.bak
3) Find the line where the computer’s old fingerprint is stored and delete it. You can search for the specific offending remote computer fingerprint using the servername and port from step #1. nano /Users/yourmacusername/.ssh/known_hosts
4) CTRL-X to quit and choose Y to save changes
Now type ssh -p port servername and you will receive the original prompt you did when you first tried to SSH to that computer. You will then be given the option to save that remote computer’s updated SHA256 fingerprint to your known_hosts file. If you’re using SSH over port 22 then the -p argument is not necessary.