I rent a shared hosting server. I have set up the login to be through keys (private/public) by the use of ssh-copy-id, and now that works when i type

ssh user@

(Since I choose to have a passphrase I get a GUI-prompt asking for password)

I had tried this once before but didn't understand then what was happening and canceled it - so it was after the second try I got to the point where I am (it works).

(B.t.w. I installed Wordpress on the server)

When I try

sudo scp webbsidekopia_1.zip user@

I get the message:


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
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /root/.ssh/known_hosts:4
remove with:
ssh-keygen -f "/root/.ssh/known_hosts" -R ""
ECDSA host key for has changed and you have requested strict checking.
Host key verification failed.
lost connection

Is this normal? Can I use both ssh-copy-id and scp? Should I remove host?

local mashine is Linux Mint 19, server is Ubuntu 18.4


Because you are using sudo on your second command, but not on your first.

Your first command is run by the your user, the second is run as root.

You need to either clean up the known keys of the root user (if you are sure that the host keys HAVE actually changed), and run ssh-copy-id again with sudo, or you skip the sudo if you don't need it.

  • I was shure you were right, but now the ssh command isn't working either, but can log in through the "digitalhosting" online console with password... then will delete like described in askubuntu.com/questions/317619 Dec 22 '20 at 17:05
  • I cleared keys/hosts on server and client, nothing happened, but after resetting the firewall I could finally log in again (ssh), but now I will not mix sudo and none-sudo. Thanks. If I can prove your method fixes the problem I will mark/check your answer - but can't change what's already happened. (digitalocean.com/community/questions/…) Dec 22 '20 at 17:57
  • I started over again, and I can log in through ssh (with key) like before. When I now do scp webbsidekopia_1.zip deploy@ it works. I see proof for that the usage of "sudo" was wrong. So ssh and scp are kind of connected/related(?) Dec 22 '20 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.