0
votes

I'm logged into root on my google cloud compute instance (Linux) and want to transfer a file onto my local desktop. I can simply do this through the browser as specified here https://cloud.google.com/compute/docs/instances/transfer-files only if I'm not root, but I cannot do it as root.

Why is this and how can I allow downloading as root? I need to intermediary cp from root to myself in order to download the file.

1
The Google Cloud Console SSH features uses your identity that you logged into the console with for the identity used for SSH. If you want to use a different identity, such as root, you will need to either use the CLI or another third-party tool PLUS you will need to change the default security settings for the SSH server running on the VM instance and set up your own key pairs. This is not recommended. - John Hanley
@JohnHanley In that case, is there a quick way to just log into the console as root? I'm not worried about security at all, I just need google for a quick task. - JobHunter69
No, there is not an easy way other than to login as a user and then sudo bash to get elevated privileges. Logging in as the root user is blocked by default. To get around that will require modifying the system's security. - John Hanley

1 Answers

1
votes

Using the SSH from the browser window lets you use SSH to connect to a Compute Engine virtual machine (VM) instance from within the Google Cloud Console.

Compute Engine manages your SSH keys for you whenever you connect to a Linux instance from your browser, creating and applying SSH key pairs when needed. You cannot manage the SSH keys that are used to connect from the browser. Instead, user access to connect from the browser is controlled by Cloud Identity and Access Management roles [1].

To connect through the browser, you must be a project member who is a compute instance admin [2]. The “root” user in the VM is an internal user for the VM, the "root" user is not a project member here. Google doesn't have any access to the VM as the “root” user of the VM.

After you (project member) have been granted access, connect to a Linux instance directly from your web browser in the Cloud Console and could transfer file [3] to the VM and then you could copy your files as required path.

[1] https://cloud.google.com/iam/docs

[2] https://cloud.google.com/compute/docs/ssh-in-browser

[3] https://cloud.google.com/compute/docs/instances/transfer-files