Search code examples
linuxazuressh-keysscp

Scp file transfer from Mac laptop to Azure Ubuntu VM


I try to transfer a VHD.gz file from my Mac to an Azure Ubuntu virtual machine. From my Mac I've launched this command :

scp path/to/XXXvhd.gz root@<Ubuntu_VM_IP>:/home/azureuser

But I have this error : root@XX.XX.XXX.XX: Permission denied (publickey).

Do you know why it doesn't work? Do I have to establish a SSH connexion?

Thanks in advance for your help

I tried to change the rights on the file with chmod but it is not clear for me if I have to change the rights also for the user, and which user: the one on my local laptop or azureuser on the Ubuntu server


Solution

  • root@XX.XX.XXX.XX: Permission denied (publickey).
    

    The error means the root@XX.XX.XXX.XX doesn't have a publickey.

    You need to put your publickey(content of ~/.ssh/id_rsa.pub) inside of the ~/.ssh/authorized_keys ofroot@XX.XX.XXX.XX.

    or try ssh-copy-id.