HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: //snap/google-cloud-cli/current/help/man/man1/gcloud_compute_config-ssh.1
.TH "GCLOUD_COMPUTE_CONFIG\-SSH" 1



.SH "NAME"
.HP
gcloud compute config\-ssh \- populate SSH config files with Host entries from each instance



.SH "SYNOPSIS"
.HP
\f5gcloud compute config\-ssh\fR [\fB\-\-dry\-run\fR] [\fB\-\-force\-key\-file\-overwrite\fR] [\fB\-\-remove\fR] [\fB\-\-ssh\-config\-file\fR=\fISSH_CONFIG_FILE\fR] [\fB\-\-ssh\-key\-file\fR=\fISSH_KEY_FILE\fR] [\fIGCLOUD_WIDE_FLAG\ ...\fR]



.SH "DESCRIPTION"

\fBgcloud compute config\-ssh\fR makes SSHing to virtual machine instances
easier by adding an alias for each instance to the user SSH configuration
(\f5~/.ssh/config\fR) file.

In most cases, it is sufficient to run:

.RS 2m
$ gcloud compute config\-ssh
.RE

Each instance will be given an alias of the form \f5NAME.ZONE.PROJECT\fR. For
example, if \f5example\-instance\fR resides in \f5us\-central1\-a\fR, you can
SSH to it by running:

.RS 2m
$ ssh example\-instance.us\-central1\-a.MY\-PROJECT
.RE

On some platforms, the host alias can be tab\-completed, making the long alias
less daunting to type.

The aliases created interface with SSH\-based programs like \fBscp(1)\fR, so it
is possible to use the aliases elsewhere:

.RS 2m
$ scp ~/MY\-FILE example\-instance.us\-central1\-a.MY\-PROJECT:~
.RE

Whenever instances are added, removed, or their external IP addresses are
changed, the remove command must be run to clear the existing configuration and
then the command can set executed to set the configuration to the current state.

This command ensures that the user's public SSH key is present in the project's
metadata. If the user does not have a public SSH key, one is generated using
\fBssh\-keygen(1)\fR (if the \f5\-\-quiet\fR flag is given, the generated key
will have an empty passphrase).



.SH "EXAMPLES"

To populate SSH config file with Host entries from each running instance, run:

.RS 2m
$ gcloud compute config\-ssh
.RE

To remove the change to the SSH config file by this command, run:

.RS 2m
$ gcloud compute config\-ssh \-\-remove
.RE



.SH "FLAGS"

.RS 2m
.TP 2m
\fB\-\-dry\-run\fR

If provided, the proposed changes to the SSH config file are printed to standard
output and no actual changes are made.

.TP 2m
\fB\-\-force\-key\-file\-overwrite\fR

If enabled, the gcloud command\-line tool will regenerate and overwrite the
files associated with a broken SSH key without asking for confirmation in both
interactive and non\-interactive environments.

If disabled, the files associated with a broken SSH key will not be regenerated
and will fail in both interactive and non\-interactive environments.

.TP 2m
\fB\-\-remove\fR

If provided, any changes made to the SSH config file by this tool are reverted.

.TP 2m
\fB\-\-ssh\-config\-file\fR=\fISSH_CONFIG_FILE\fR

Specifies an alternative per\-user SSH configuration file. By default, this is
\f5\fI~/.ssh/config\fR\fR.

.TP 2m
\fB\-\-ssh\-key\-file\fR=\fISSH_KEY_FILE\fR

The path to the SSH key file. By default, this is
\f5\fI~/.ssh/google_compute_engine\fR\fR.


.RE
.sp

.SH "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 \fB$ gcloud help\fR for details.



.SH "NOTES"

These variants are also available:

.RS 2m
$ gcloud alpha compute config\-ssh
.RE

.RS 2m
$ gcloud beta compute config\-ssh
.RE