How to fix a bad host error in Shell


I cannot log in to Shell through a Shell client or through the command prompt and I receive an error message. How do I fix it?

Error message

The error message may have looked like this. This is a macOS-based example:

---Last login: Mon Jun 28 12:28:45 on console
your_computer_username@UO-1234567 ~ % ssh
The RSA host key for has changed,
and the key for the corresponding IP address
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
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 RSA key sent by the remote host is
Please contact your system administrator.
Add correct host key in /Users/your_computer_username/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/your_computer_username/.ssh/known_hosts:5
RSA host key for has changed and you have requested strict checking.
Host key verification failed.
your_Duck_ID@UO-1234567 ~ %


The issue at hand may have to do with a recent upgrade of the operating system on which UO Shell resides. Any upgrade could impact your saved host keys on your account. This means that you may have to resolve your known hosts text file. Additionally, you can verify if your Shell account may be spoofed by unknown users through the domain name service (DNS).

How to fix the known hosts text file

macOS via Finder

For macOS users, go into the Finder, click on the Go menu, and select the Connect to Folder option. Then enter the following in the dialog box field.

  • ~/.ssh/known_hosts

Once entered, the text file will appear in the Finder window. Double-click on the known_hosts file to open it in your computer's text editor. Delete the key out of your file, save the file, then try again.

Upon reconnection, you should be prompted to add the new host. Use your Duck ID and password to confirm.

macOS via Terminal or Windows

For macOS users, open Terminal and enter the following. For Windows users, open the Command Prompt or PowerShell application then enter the following:

  • ssh

Upon signing in, enter the command:

  • vim ~/.ssh/known_hosts

This will list all of the known hosts within the known_hosts file. You can either remove its entire contents or target a particular host.

Deleting the entire file

If you only have one host in your known_hosts file then removing the entire file is a solution. The file will be recreated once you sign into Shell on that computer. Before you remove the file you should back up the contents, just in case:

  1. Copy: 
    cp ~/.ssh/known_hosts ~/.ssh/known_hosts.old
  2. ...then remove:
    rm ~/.ssh/known_hosts
Removing a particular host using an example

If you need to target a particular host that is causing the error, you can tell which host needs resolution based on the error message you would have received. Look for the text that states a change. Below is an example host needing attention:

The RSA host key for has changed

You can now target the particular key you wish to remove. For the example host key seen above, enter the following:

  • ssh-keygen -R

When successful, you should see the following:

For macOS via Terminal users

  • .com found: line 1github.articletest# Host
    /known_hosts updated.ssh/Users/your_computer_name/.
    Original contents retained as /Users/your_computer_name/.ssh/known_hosts.old

For Windows users

  • .com found: line 1github.articletest# Host
    /known_hosts updated.ssh/home/user/.
    Original contents retained as /home/user/.ssh/known_hosts.old

Once the hostname has been removed, you can close the Terminal, Command Prompt, or PowerShell window.

Additional Support

If you need additional assistance, please create a ticket through the Desktop & Devices Support service page.


Article ID: 133738
Mon 6/28/21 2:55 PM
Mon 12/19/22 10:16 AM