I have a simple bash script to get files from my droplet like this:
scp -r root@xx.xxx.xxx.xxx:/var/sourcefolder/ /home/user/destinationfolder
It’s ok when i just run script, it works.
But if I run it’s under root I’ve get:
The authenticity of host ‘xx.xxx.xxx.xxx (xx.xxx.xxx.xxx)’ can’t be established.
ECDSA key fingerprint is SHA256:XXxxXxXXx....
Are you sure you want to continue connecting (yes/no)?
So I’m curious, is it an expected behavior and I should setup another key pair, or I’m doing something wrong.
Thanks )

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @Shipin16Shark,

The authenticity of host ‘xx.xxx.xxx.xxx (xx.xxx.xxx.xxx)’ can’t be established.
ECDSA key fingerprint is SHA256:XXxxXxXXx....

This just means you haven’t added the host under the known_hosts file, in your .ssh folder using the user root. It’s no biggie. If you accept it once, this host with user root will be added to known_hosts and you won’t be experiencing the same messages.

  • Thanks for answer )
    I also thought this way and just pressed yes, but once I tried script after that I’ll got next:
    root@xx.xxx.xxx.xxx: Permission denied (publickey).
    At which point I stopped trying do something I don’t know and reached here
    Not sure why I have this error… thought I need one key pair for one PC

    • Hi @Shipin16Shark,

      Yes, you do need one key. Having said that, you need to add the key for the root account it seems.

      So you need to add the key at /root/.ssh/authorized_keys for the key to work.

      • Thanks again, unfortunately I was unable to find this authorized_keys file anywhere in my ubuntu sistem, but what worked for me is just copy id_rsa id_rsa.pub files from ~/.ssh into /root/.ssh. Wrote it in case anyone had same issue and to get shout at if I have done something terribly dangerous

        • Hi @Shipin16Shark,

          Thank you for answering back and giving back to the community!

          It’s fine what you’ve done, it’s not dangerous. As long as you have the proper permissions of the .ssh folder.