Connect to a Linux VM using SSH
Required roles
To follow the steps in this guide, you need the following roles:
- Compute Viewer on the project.
- IAP-Secured Tunnel User on the project or VM.
Depending on the configuration of your VM, you might also need:
- Compute OS Login (if OS Login is enabled) or Compute Instance Admin (if OS Login is disabled) on the project or VM.
- Service Account User on the project or VM (if the VM has an attached service account).
To connect to a Linux VM by using SSH, do the following:
- In the Project Explorer tool window, right-click a VM instance and select Connect:
-
IAP Desktop now automatically publishes your SSH public key , creates an IAP TCP forwarding tunnel, and opens a terminal:
Customize connection settings
To customize the connection settings, you can use the Connection Settings tool window:
- In the Project Explorer tool window, right-click a VM instance and select Connection Settings.
-
In the Connection Settings window, customize settings as needed.
If you specify a setting that deviates from the default, it is shown in bold typeface.
Instead of customizing settings for each VM instance individually, you can also specify settings that apply to an entire zone or projects:
- In the Project Explorer tool window, right-click a zone or project and select Connection Settings.
- In the Connection Settings window, customize settings as needed. The settings apply to all VM instances in the respective zone or project, unless explicitly overridden.
For more information about customizing connection settings, see Connection settings.
Frequently Asked Questions
Which SSH key does IAP Desktop use for authentication?
By default, IAP Desktop uses an ECDSA NISTP-256 key pair for SSH public key authentication. The key is created automatically on first use, is managed using the Microsoft Software Key Storage Provider , and is not exportable.
For more details, see SSH algorithms and keys.
Can I use an existing private key instead?
No, IAP Desktop maintains its own RSA key pair. But Google Cloud lets you use multiple SSH keys, so you can continue to use your existing private key for other SSH clients.
What's next
- Troubleshoot common SSH issues
- See how you can connect to Windows VMs by using Remote Desktop
- Learn how you can connect to SQL Server