# How to set a password on a virtual machine instance

Source: https://docs.quake.ai/docs/compute/how-to/create-password
Markdown: https://docs.quake.ai/docs/compute/how-to/create-password.md

---

# How to set a password on a virtual machine instance

Set a login password on an instance so you can access it via the [web console](/docs/compute/how-to/use-vm-console). Passwords are an alternative to SSH key pairs for console-based access.



SSH key pairs are the recommended login method for remote shell access. Passwords are typically used together with the in-browser VNC console when SSH is unavailable, for example during OS installation or when locked out.



<PrerequisiteBlock methods={["console", "cli"]} />

## Set a password during instance creation

<MethodTabs>
<Method label="Console">

1. Select **Compute** > **Instances** > **Create Instance**.
2. Complete the **Base Config** and **Network Config** tabs.
3. In the **System Config** tab, set the **Login Type** toggle to **Password** (the other option is **Keypair**).
4. The **Admin User** field is read-only and shows the default OS account for the selected image (for example, `ubuntu` for the Ubuntu image; see the [Default usernames by distribution](#default-usernames-by-distribution) table below).
5. Enter the **Login Password** and confirm it in **Confirm Password**.
6. Select **Next: Confirm Config** and confirm.



If you forget the Admin User or the Login Password, you cannot connect to the instance. Record both before you finish the wizard.



</Method>
<Method label="CLI">

The OpenStack CLI does not set a password during creation directly. Create the instance, then set the password:

```bash
openstack server create \
  --flavor s1a.micro \
  --image "Ubuntu-24.04" \
  --boot-from-volume 10 \
  --network PublicEphemeral \
  my-instance
```

```bash
openstack server set --password my-instance
```

The system prompts you to enter and confirm the new password.

</Method>
</MethodTabs>

## Change the password on a running instance

<MethodTabs>
<Method label="Console">

On a running instance, log in via SSH and use the standard Linux password change command:

```bash
sudo passwd ubuntu
```

Replace `ubuntu` with the username for your distribution.

</Method>
<Method label="CLI">

```bash
openstack server set --password my-instance
```

</Method>
</MethodTabs>

## Default usernames by distribution

The default login username depends on the OS image. Use this table as a reference:

| Distribution | Default username |
|---|---|
| Ubuntu | `ubuntu` |
| Debian | `debian` |
| CentOS | `centos` |
| Fedora | `fedora` |
| RHEL | `cloud-user` |
| Rocky Linux | `rocky` |
| AlmaLinux | `almalinux` |
| OpenSUSE | `opensuse` |
| Arch Linux | `arch` |

Verify the username against the image's official documentation if uncertain.

## See also

- [Use the virtual machine console](/docs/compute/how-to/use-vm-console)
- [Create an instance](/docs/compute/how-to/create-instance)
- [Instances concepts](/docs/compute/concepts/instances)
