`gcloud compute copy-files`: permission denied when copying files

bryan picture bryan · Jan 6, 2015 · Viewed 27.8k times · Source

I'm having a hard time copying files over to my Google Compute Engine. I am using an Ubuntu server on Google Compute Engine.

I'm doing this from my OS X terminal and I am already authorized using gcloud.

local:$ gcloud compute copy-files /Users/Bryan/Documents/Websites/gce/index.php example-instance:/var/www/html --zone us-central1-a
Warning: Permanently added '<IP>' (RSA) to the list of known hosts.
scp: /var/www/html/index.php: Permission denied
ERROR: (gcloud.compute.copy-files) [/usr/bin/scp] exited with return code [1].

Answer

Mailis Toompuu picture Mailis Toompuu · Mar 27, 2015

insert root@ before the instance name:

local:$ gcloud compute copy-files /Users/Bryan/Documents/Websites/gce/index.php root@example-instance:/var/www/html --zone us-central1-a