Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SSH errors - Operation not permitted when attempting to ssh into another unraid server.

Featured Replies

I have two servers one running 6.9.2 and my backup server is on 6.10-rc7. When attempting to connect from the backup server to my primary, I get the below error. When doing the inverse everything works correctly and no errors reported. I have tried deleting the .ssh folder from the flash/configs and recreating the connection but the problem persists. Also tried resetting permissions, still a no go. Any idea what causes this?

It does seem to allow the connection I just don't like errors. Thanks in advance for any help.

 

root@XXXXXX:~# ssh 10.10.1.2
Enter passphrase for key '/root/.ssh/id_ed25519': 
hostfile_replace_entries: link /root/.ssh/known_hosts to /root/.ssh/known_hosts.old: Operation not permitted
update_known_hosts: hostfile_replace_entries failed for /root/.ssh/known_hosts: Operation not permitted

 

Edited by xxnumbxx
spelling

  • Author

Any ideas?

  • Community Expert

I think I remember seeing the same thing when connecting from a server running an older release, but since it still worked didn't though much about it, it should go away once you update the backup server.

  • Community Expert

Turns out this can also occur between two servers running v6.10-rc, so lets see if someone has an idea on what's causing this, or you can create a bug report.

In the interim it might be possible to bypass that if you are confident of no man in the middle attacks and bypass the host key check using:

ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null  

Not sure if it will work in this exact scenario.

  • 3 weeks later...

I have this same problem since updating to 6.10.2. I have two unraid servers both on 6.10.2  If I SSH in from one to the other I get the error "hostfile_replace_entries: link /root/.ssh/known_hosts to /root/.ssh/known_hosts.old: Operation not permitted
update_known_hosts: hostfile_replace_entries failed for /root/.ssh/known_hosts: Operation not permitted". It does proceed to log me in though. I tried clearing the known host file and it did then update the file despite the message. The other oddity is it only does it in one direction. If I SSH in form the other server it works fine. I can see no difference between the file permissions. The only other difference I can think of is that on one server I updated regularly through the 6.10 beta releases and on the other I went from 6.9 straigh to the stable release of 6,10. I see that this was reported with OpenSSH  but it was patched some while ago

 

Hi,
first Post and an than a solution :D

if any one have this error like me:

 

update_known_hosts: hostfile_replace_entries failed for /root/.ssh/known_hosts: Operation not permitted

 

I found this work for me:

 

ssh-keyscan -H TARGET_HOST >> ~/.ssh/known_hosts

 

on both systems and the error is gone.

 

  • Community Expert
27 minutes ago, zer0.de said:

I found this work for me:

Thanks, also worked for me.

Thank you. It worked for me!

  • 5 weeks later...
On 6/5/2022 at 4:37 AM, zer0.de said:

Hi,
first Post and an than a solution :D

if any one have this error like me:

 

update_known_hosts: hostfile_replace_entries failed for /root/.ssh/known_hosts: Operation not permitted

 

I found this work for me:

 

ssh-keyscan -H TARGET_HOST >> ~/.ssh/known_hosts

 

on both systems and the error is gone.

 


I was having this error when SSH'ing into a non-unraid box too.  This `ssh-keyscan` command also resolved the issue for me. Thanks!

  • 2 weeks later...
On 6/5/2022 at 12:37 PM, zer0.de said:

 

ssh-keyscan -H TARGET_HOST >> ~/.ssh/known_hosts

 

Worked for me too 6.10.3 so thank you.

 

 

  • 5 months later...
On 6/5/2022 at 4:37 AM, zer0.de said:

I found this work for me:

 

ssh-keyscan -H TARGET_HOST >> ~/.ssh/known_hosts

 

on both systems and the error is gone.

 

Thank you! this worked for me too.

I'm SSHing to a remote Raspian OS server over Wireguard. I'm getting theses same errors when Rsync'ing to the remote server. 

 

Do I need to replace any of the command test?

 

I tried this command replacing the TARGET_HOST part with the SSH address of my other server. i.e. [email protected] but I get this output in unRAID's CLI:

getaddrinfo [email protected]: Name or service not known
getaddrinfo [email protected]: Name or service not known
getaddrinfo [email protected]: Name or service not known
getaddrinfo [email protected]: Name or service not known
getaddrinfo [email protected]: Name or service not known

 

Any ideas? 

 

Edited by adminmat

  • Community Expert
6 hours ago, adminmat said:

Any ideas? 

Use only the target IP address.

Ok I had to first delete the contents from the /root/.ssh/known_keyhosts file. Then after running the command above I'm no longer getting the errors. Thanks.

 

 

  • 1 year later...

Still helping to this date with the fix!

On 6/5/2022 at 9:37 PM, zer0.de said:

Hi,
first Post and an than a solution :D

if any one have this error like me:

 

update_known_hosts: hostfile_replace_entries failed for /root/.ssh/known_hosts: Operation not permitted

 

I found this work for me:

 

ssh-keyscan -H TARGET_HOST >> ~/.ssh/known_hosts

 

on both systems and the error is gone.

 

Still helping to this day. Thanks!

  • 5 months later...

Hi,

 

i also have this error. 

 

I run the ssh-keygen on the firs server without problems. But my second server has not the standard port. I tried 

 

ssh-keyscan -H 192.168.2.120:2001 >> ~/.ssh/known_hosts

 

but this doesn´t work.

 

How can i run ssh-keyscan with a server on an other port?

 

Thanks!

  • 4 weeks later...

In my case, the command also didn't solve the issue. A look into the known_hosts file revealed that the IP (not the port) was written in square brackets. After I removed those, it worked.

  • 2 weeks later...

I lost an hour before I found the best solution. Here is the full version of this command that also works for ssh servers running on a port other than 22 and for messages like:

 

getaddrinfo user@address: Name or service not known

 

ssh-keyscan -H -p SSH_PORT TARGET_HOST >> ~/.ssh/known_hosts

 

Edited by jaclas
correct command syntax

  • 2 weeks later...

If anyone is interested in why this error happens in the first place, it's because (I believe) the file system on /boot is vfat. The ssh command wants to update the known_hosts file and it tries to make a backup copy of known_hosts using the link command ln. But it's trying to make a hard link, and hard links aren't supported on vfat file systems. So the operation isn't permitted. 

 

By running the ssh-keyscan and adding its output to known_hosts, ssh is happy with the content of known_hosts and doesn't need to update it, so the error is avoided.

 

 

  • 2 weeks later...
On 11/3/2024 at 11:22 AM, MrChip said:

If anyone is interested in why this error happens in the first place, it's because (I believe) the file system on /boot is vfat. The ssh command wants to update the known_hosts file and it tries to make a backup copy of known_hosts using the link command ln. But it's trying to make a hard link, and hard links aren't supported on vfat file systems. So the operation isn't permitted. 

 

By running the ssh-keyscan and adding its output to known_hosts, ssh is happy with the content of known_hosts and doesn't need to update it, so the error is avoided.

 

 

I try and run that command, and it seems to go through but then i immediately run a ssh ****@*****.rsync.net ls and I get :

ssh: connect to host *******.rsync.net port 22: Network is unreachable

Then after a short time I'm able to send commands again but I still get:

hostfile_replace_entries: link /root/.ssh/known_hosts to /root/.ssh/known_hosts.old: Operation not permitted
update_known_hosts: hostfile_replace_entries failed for /root/.ssh/known_hosts: Operation not permitted

Now everything does seem to work but those errors persist.  I've done the same thing to the same server from my windows machine without issue.  But this remains on my unraid server.

How would this work if the target is a Windows Computer that is not running sshd? I'm using Filezilla on Windows to connect.

  • 8 months later...
On 10/26/2024 at 10:46 AM, jaclas said:

I lost an hour before I found the best solution. Here is the full version of this command that also works for ssh servers running on a port other than 22 and for messages like:

 

getaddrinfo user@address: Name or service not known

 

ssh-keyscan -H -p SSH_PORT TARGET_HOST >> ~/.ssh/known_hosts

 

you are my hero, thank you!

Edited by bruise_lee

  • 3 months later...
  • Community Expert

Had this error too: hostfile_replace_entries: link /root/.ssh/known_hosts to /root/.ssh/known_hosts.old: Operation not permitted

Tried all above. No go.

However, can login with password or by using

ssh -i ~/.ssh/id_ed25519 root@ipaddress

Any help appreciated

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.