Today I have create a Debian instance on gce. when I try to copy a file as root I get the following message:
Permission denied (publickey).
lost connection
On another instance create a few months ago I able to copy-file with root.
The command used is the following:
gcloud compute copy-files test/test.txt root@test:/opt/ --project p-id --zone z
For security reasons, newer VM images don't allow direct log-in as root via SSH. You can log in as a non-root user, which will have sudo
permissions, and set up root-user SSH yourself, though this is not recommended. Instead, copy the file over to a non-privileged location and use the gcloud compute ssh
as a non-root user and the sudo
command to move the file where it needs to be.