1

I've seen this question asked before but the answers always seemed to lack some specificity. I am having trouble moving some user interface files from my own machine to my server which resides on a Digital Ocean Droplet with Ubuntu 20.04. I can connect to my server just fine via SSH. I have a non-root user configured and the public RSA key of my machine is in .ssh/authorized_keys on the server.

However, when I try to SCP the files from my local machine to my server with

sudo scp -rv path/to/folder user@<ip>:/var/www/html

I get a response

The authenticity of host <ip> can't be established.
ECDSA key fingerprint is <fingerprint>.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

which is talking about an ECDSA key fingerprint not matching. I have not configured a ECDSA key. Is it the default behaviour of SCP to use ECDSA? I even tried to add the -i flag to specify the identity file directly (the private RSA key on my machine) but it did not have any effect on the outcome.

There were some answers that mentioned that this happens when connecting first time to the server. However, I have connected to this server via SSH before. Is it different when using SCP, i.e. does this count as a first connection?

4
  • 2
    Why are you using sudo? Do you use sudo with ssh as well? Jan 3, 2021 at 16:27
  • The authentication goes both ways. When you say "I have not configured a ECDSA key" or "I have a non-root user configured" it's not clear if you mean the client or the server. Did you use sudo ssh …? Jan 3, 2021 at 16:28
  • Oh wow, that was it @ArkadiuszDrabczyk. I cannot believe it was because of something so simple. It worked fine without sudo. Earlier I got a "Permission denied" error when trying to SCP the files into /var/www on the server. I thought the problem was because I was not using sudo.
    – jonraem
    Jan 3, 2021 at 16:41
  • 1
    Side note: using sudo on the client will not grant you privileges (like write access to /var/www) on the server. Jan 3, 2021 at 16:48

1 Answer 1

0

Don't use sudo - you very rarely need to use sudo with commands that connect to the remote servers, even if you connect to them as root. Off the top of my head, sudo would be needed only if you'd like to transfer files which are not owned by the regular user or groups it belongs to or run a custom ProxyCommand that requires root.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .