Best practices for securing SSH access to VM instances Stay organized with collections Save and categorize content based on your preferences.
When you grant users access to connect to virtual machine (VM) instances usingSSH, you impact the security of your VM and any resources that your VM hasaccess to, such as storage buckets or databases.
You can limit the risks related to SSH access by following several best practices,including:
Control network access:Implement zero trust access controls to restrict the networks, locations, anddevices from which users can establish SSH connections to your VMs,and avoid VMs from being more exposed than necessary.
Control SSH login access:Restrict which users are allowed to establish SSH sessions and ensure that loginaccess is revoked in a timely manner.
Protect SSH credentials:Require users to authenticate with multiple factors and protect credentials frombeing leaked.
Audit SSH access: Maintain areliable audit trail that tracks all SSH access.
What's next
- Learn more about thebest practices for controlling SSH network access
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.