TrueNAS Scale SSH access setup

Hi,

Ok, so I am struggling to enable SSH access and I’m not sure why.

What I’ve done:

  • Enabled SSH in system > services > SSH
  • Added SSH credentials in credentials > backup credentials

I keep getting the following message and no access and got no clue why.

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 ED25519 key sent by the remote host is
SHA256:192Ss7BIsBV80hrl5NVvENB7mFUGtWMSUuT2D8lh/Sk.

Please contact your system administrator.
Add correct host key in /Users/[local client username]/.ssh/known_hosts to get rid of this message.

Offending ED25519 key in /Users/[local client username]/.ssh/known_hosts:4

Host key for 192.168.50.63 has changed and you have requested strict checking.

Could someone please help me?

That message is telling you that the last time your client successfully connected to that IP address, it received a different host key.

If some other SSH server has that IP address in the past, and if this is no surprise to you, you can safely edit that .ssh/known_hosts file and remove that host key. The next time you connect to your TrueNAS via SSH it will ask you to confirm that the new host key is correct.

Ordinarily I would have found this very useful, but this was a brand new TrueNAS Scale install and this was the first time I was trying to connect via SSH.

Thank you for your input.

I did eventually connect via SSH but I can’t remember how I sorted it out. It was rather sheer dumb luck. I think it was because I added my laptop IP into the global config under the hosts IP or something as I read that box adds the IP address to the hosts file. I think that is when it allowed me to connect and SSH into the server.

It should have been by doing what the message you posted suggests: edit ~/.ssh/known_hosts to remove the offending host key. The message even tells you which line it’s at.

Yes, I realise that but when I googled how to edit the hosts file on truenas scale, there was a response in one of the forums stating that you can’t edit it so I was stuck between a rock and a hard place >>> how do I edit a file I am not allowed to edit on truenas scale?

Why did you google that? “Edit known_hosts on a client machine” is a very different operation than “edit /etc/hosts on the server.”

You don’t, and you don’t need to. The hosts file on the NAS has nothing at all to do with the warning you’re seeing (or at least with the warning you mention in the beginning of this topic).

Ok, then I am heavily misunderstanding things.

I googled the entire error above and the consensus was on Reddit and a couple posts on here (if I recall) that it was to edit the hosts file in the NAS.

I was under the impression that this section meant adding info into the hosts file of trueNAS:

"Please contact your system administrator.
Add correct host key in /Users/[local client username]/.ssh/known_hosts to get rid of this message.

Offending ED25519 key in /Users/[local client username]/.ssh/known_hosts:4

Host key for 192.168.50.63 has changed and you have requested strict checking."

If I may ask, where would I find the host file in macOS and if you could provide a clue as to what I should add to it, I would be grateful.

The error message you quote tells you exactly where the file you need to edit (which, once again, is not the hosts file) is located:

/Users/[local client username]/.ssh/known_hosts

…and it also tells you which line contains the (old and thus incorrect) host key, which is line 4. Edit that file with whatever text editor you like (nano works fine: nano ~/.ssh/known_hosts; ~ is a shortcut for the user’s home directory) and remove that line–in addition to knowing that it’s line 4, you can also identify it by the fact that it will begin with the host IP address (192.168.50.63). Then save the file (Ctrl-X will exit nano, prompting to save) and try connecting via SSH again.

1 Like

Thank you. That did it.

I completely misunderstood the error message