I'm trying to copy some files from my machine to an Azure VM. I say in advance that I can ssh the Azure's VM, I gave my public key during the creation of the machine. Both machines are Linux.
When I try:
sudo scp /path/ca.crt ubuntu@ip.add.res.s:~/
I receive in output:
Permission denied (publickey).
lost connection
I'm not pointing on a root directory (my file is in a root directory that's why the sudo); I'm not pointing to a wrong user; if I can connect through ssh why scp should be denied?