:_mod-docs-content-type: ASSEMBLY
include::_attributes/common-attributes.adoc[]
[id="virt-using-virtctl-ssh"]
= Configure SSH by using the virtctl CLI tool
:context: virt-using-virtctl-ssh

toc::[]

[role="_abstract"]
You can add a public SSH key to a virtual machine (VM) and connect to the VM by running the `virtctl ssh` command, or add the `virtctl port-foward` command to your `.ssh/config` file and connect to the VM by using OpenSSH.

[IMPORTANT]
====
The `virtctl ssh` command method is not recommended for high traffic loads because it places a burden on the API server.
====

You can add public SSH keys to {op-system-base-full} 9 VMs at runtime or at first boot to VMs with guest operating systems that can be configured by using a cloud-init data source.

[TIP]
====
You can copy the `virtctl ssh` command in the web console by selecting *Copy SSH command* from the options {kebab} menu beside a VM on the *VirtualMachines* page.

Alternatively, right-click the VM in the tree view and select *Copy SSH command* from the menu to copy the `virtctl ssh` command.
====

include::modules/virt-about-static-and-dynamic-ssh-keys.adoc[leveloffset=+1]

include::modules/virt-static-key-management-vm.adoc[leveloffset=+1]

:context: static-key
:static-key:
include::modules/virt-adding-key-creating-vm-template.adoc[leveloffset=+2]

include::modules/virt-creating-vm-instancetype.adoc[leveloffset=+2]
:!static-key:

include::modules/virt-adding-public-key-vm-cli.adoc[leveloffset=+2]

include::modules/virt-adding-dynamic-key-vm.adoc[leveloffset=+1]

:context: dynamic-key
:dynamic-key:
include::modules/virt-adding-key-creating-vm-template.adoc[leveloffset=+2]

include::modules/virt-creating-vm-instancetype.adoc[leveloffset=+2]

include::modules/virt-editing-vm-dynamic-key-injection.adoc[leveloffset=+2]
:!dynamic-key:

include::modules/virt-enabling-dynamic-key-injection-cli.adoc[leveloffset=+2]

include::modules/virt-using-virtctl-ssh-command.adoc[leveloffset=+2]

include::modules/virt-using-virtctl-port-forward-command.adoc[leveloffset=+1]

////
[role="_additional-resources"]
[id="additional-resources_{context}"]
== Additional resources
////
