---
title: "Delete a security group"
sidebar_label: "Delete a security group"
sidebar_position: 7
description: "How to delete a security group"
---

import Formbricks from '@theme/MDXComponents/Formbricks';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import { TabItemLabel } from '@selectel/docux/components';
import TrashIcon from '@selectel/docux/icons/trash';
import MoreVerticalIcon from '@selectel/docux/icons/more-vertical';
import CopyIcon from '@selectel/docux/icons/copy';

# Delete a security group

Before deleting a group, you must detach it from all ports it is assigned to.

<Tabs queryString="delete-group">
  <TabItem value="panel">
    <TabItemLabel>
      Control panel
    </TabItemLabel>

    1. Ensure you have [detached the security group from all ports](/cloud-servers/security-groups/manage-groups/remove-group-from-port.mdx). You can view the list of ports with the group in the [control panel](https://my.selectel.ru/vpc/default/security-groups): in the top menu, click **Products** → **Cloud Servers** → **Security Groups** → security group page → **Ports**.

    2. In the [control panel](https://my.selectel.ru/vpc/default/security-groups), in the top menu, click **Products** and select **Cloud Servers**.

    3. Go to the **Security Groups**.

    4. In the  security group menu, select **Delete**.<MoreVerticalIcon />

    5. Click **Delete**.
  </TabItem>

  <TabItem value="openstack">
    <TabItemLabel>
      OpenStack CLI
    </TabItemLabel>

    1. [Open the OpenStack CLI](/cloud-servers/tools/openstack-cli/).

    2. Detach the group from each individual port in the public or private subnet it is assigned to:

       ```bash
       openstack port unset \
           --security-group <security-group> \
           <port>
       ```

       Specify:

       * `<security_group>` — security group ID or name; can be viewed using the `openstack security group list` command;
       * `<port>` — the port ID with the group. You can copy it in the [control panel](https://my.selectel.ru/vpc/default/security-groups): in the top menu, click **Products** → **Cloud Servers** → **Security Groups** → security group page → **Ports** tab → in the **UUID** field, click .<CopyIcon />

    3. If the group is assigned to a port with a direct public IP address, detach it from the port using the Control Panel.

    4. Delete the security group:

       ```bash
       openstack security group delete <security_group>
       ```

       Specify `<security_group>` — security group ID; can be viewed using the `openstack security group list`.
  </TabItem>
</Tabs>

<Formbricks />
