- NAME
-
- gcloud compute os-login ssh-keys update - update an SSH public key in an OS Login profile
- SYNOPSIS
-
-
gcloud compute os-login ssh-keys update--ttl=TTL(--key=KEY|--key-file=KEY_FILE) [GCLOUD_WIDE_FLAG …]
-
- DESCRIPTION
-
gcloud compute os-login ssh-keys updateaccepts either a string containing an SSH public key or a filename for an SSH public key, and updates the key in the user's OS Login profile. Currently, only the expiration time,, can be updated.--ttl - EXAMPLES
- To update the SSH public key found in
/home/user/.ssh/id_rsa.pubwith an expiration time of one week from now, run:gcloud compute os-login ssh-keys update --ttl = 7d --key-file = /home/user/.ssh/id_rsa.pubTo update the SSH public key with a fingerprint of 'e0d96d6fad35a61a0577f467940509b5aa08b6dea8d99456ec19a6e47126bc52' and an expiration time of five years from now, run:
gcloud compute os-login ssh-keys update --ttl = 5y --key = 'e0d96d6fad35a61a0577f467940509b5aa08b6dea8d99456ec19a6e47126bc52' - REQUIRED FLAGS
-
-
--ttl=TTL - The amount of time before the SSH key expires. For example, specifying
will set the expiration time on the SSH key for 30 minutes from the current time. A value of 0 will result in no expiration time. See $ gcloud topic datetimes for information on duration formats.30m - Exactly one of these must be specified:
-
--key=KEY - The SSH public key to update the OS Login Profile. Key value can either be the SSH key or the OS Login fingerprint of the key.
-
--key-file=KEY_FILE - The path to a file containing an SSH public key to update the OS Login Profile. Key value can either be the SSH key or the OS Login fingerprint of the key.
-
-
- GCLOUD WIDE FLAGS
- These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$ gcloud helpfor details. - NOTES
- These variants are also available:
gcloud alpha compute os-login ssh-keys updategcloud beta compute os-login ssh-keys update
gcloud compute os-login ssh-keys update
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-05-27 UTC.

