1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/virt-using-virtctl-ssh-command.adoc
2025-12-10 18:10:51 +00:00

36 lines
1.0 KiB
Plaintext

// Module included in the following assemblies:
//
// * virt/managing_vms/virt-accessing-vm-ssh.adoc
:_mod-docs-content-type: PROCEDURE
[id="virt-using-virtctl-ssh-command_{context}"]
= Using the virtctl ssh command
[role="_abstract"]
You can use the `virtctl ssh` command to access a running virtual machine instance (VMI). The command accepts VM or VMI targets.
.Prerequisites
* You installed the `virtctl` command-line tool.
* You added a public SSH key to the VM.
* You have an SSH client installed.
* The environment where you installed the `virtctl` tool has the cluster permissions required to access the VM. For example, you ran `oc login` or you set the `KUBECONFIG` environment variable.
.Procedure
. Run the `virtctl ssh` command:
+
[source,terminal]
----
$ virtctl -n <namespace> ssh <username>@vm/<vm_name> -i <ssh_key>
----
+
You must specify the resource type (`vmi/` or `vm/`) before the VM name.
+
For example:
+
[source,terminal]
----
$ virtctl -n my-namespace ssh cloud-user@vm/example-vm -i my-key
----