This document describes the steps to configure and manage a guest environment on
a virtual machine (VM) instance in Google Distributed Cloud (GDC) air-gapped.
The Distributed Cloud guest environment is a necessary component to configure SSH keys on your virtual machines (VM) to both connect and transfer files remotely. You must have the guest environment before you [connect to a VM](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/vms/connect-to-vm/connect-to-a-vm.md.txt) and [transfer files](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/vms/connect-to-vm/transfer-files.md.txt), where you configure the SSH keys and use the secure copy (SCP) command-line tool. The guest environment is installed and enabled by default on all GDC VMs.

This document is for developers in platform administrator or application operator
groups that manage the guest environment for VMs in a Distributed Cloud
environment. For more information, see
[Audiences for GDC air-gapped documentation](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/resources/audiences.md.txt).

### Request IAM roles

To manage the guest environment in a VM system within the project namespace,
contact your IAM Project Admin to request the **Virtual Machine Project Admin**
(`project-vm-admin`) role.

All VM roles must bind to the namespace of the project where the VM resides.
Follow the steps to [verify](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/vms/preparation.md.txt#verify-user-access)
your access.

## Disable access management

Follow these steps to disable the access management feature while keeping the
guest environment enabled:

1. Stop your VM.
2. Edit the VM `spec` field:

   ```bash
   kubectl --kubeconfig MANAGEMENT_API_SERVER \
     -n VM_NAMESPACE \
     edit virtualmachines.virtualmachine.gdc.goog VM_NAME
   ```

   Replace <var translate="no">`VM_NAME`</var> with your VM name, and
   <var translate="no">`VM_NAMESPACE`</var> with your VM namespace.
3. Add the following fields to the `spec` field:

   ```yaml
   apiVersion: virtualmachine.gdc.goog/v1
   kind: VirtualMachine
   metadata:
     name: vm-example
     namespace: project-example
   spec:
     guestEnvironment:
       accessManagement:
         enable: false
   ```

   The `name` field contains your VM name, and the `namespace` field contains
   your VM namespace.
4. [Restart your VM](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/vms/manage-vms/operations-and-lifecycle/start-and-stop-vm.md.txt#restart-a-vm).