I am trying to copy local files to /var/www/
.
The instance has two sets of keys. One for the instance creator that's generated by default and one for remote access that I have set up manually.
I have successfully logged in via gcloud
as the latter user, and I can change to root once I'm logged in. But when I try to log in with root privileges via root@instance-name
or instance-creator-name@instance-name
, I get Permission denied (publickey)
.
Do I need to generate a new key pair for the instance creator? Can the instance creator's private key be found somewhere (wouldn't that violate security)? Is there another way to log in as root?
Edit: The docs leaves that part unspecified.
The following example demonstrates copying a folder called css into the >default document directory and doing so as the root user because that user owns the /var/www remote directory:
$ gcloud compute copy-files ~/mysite/css root@<YOUR-INSTANCE>:/var/www
This should work according to the docs, but I get Permission denied
instead. Thinking I might have messed up my SSH configuration, I forced gcloud to use the default private key and then my manually generated key, but neither worked.