<a id="devices-unix-hotplug"></a>

# Type: `unix-hotplug`


            <p class="youtube_link">
              <a href="https://www.youtube.com/watch?v=C2e3LD5wLI8" target="_blank">
                <span title="LXD Unix devices - YouTube" class="play_icon">▶</span>
                <span title="LXD Unix devices - YouTube">Watch on YouTube</span>
              </a>
            </p>
        
#### NOTE
The `unix-hotplug` device type is supported for containers.
It supports hotplugging.

Unix hotplug devices make the requested Unix device appear as a device in the container (under `/dev`).
If the device exists on the host system, you can read from it and write to it.

The implementation depends on `systemd-udev` to be run on the host.

## Device options

`unix-hotplug` devices have the following device options:

<!-- Include content from [../metadata.txt](../metadata.txt) -->

<a id="device-unix-hotplug-device-conf:gid"></a>
`gid`

GID of the device owner in the container

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-hotplug-device-conf:gid)

| **Key:**     | `gid`   |
|--------------|---------|
| **Type:**    | integer |
| **Default:** | `0`     |

<a id="device-unix-hotplug-device-conf:mode"></a>
`mode`

Mode of the device in the container

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-hotplug-device-conf:mode)

| **Key:**     | `mode`   |
|--------------|----------|
| **Type:**    | integer  |
| **Default:** | `0660`   |

<a id="device-unix-hotplug-device-conf:ownership.inherit"></a>
`ownership.inherit`

Whether this device inherits ownership (GID and/or UID) from the host

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-hotplug-device-conf:ownership.inherit)

| **Key:**     | `ownership.inherit`   |
|--------------|-----------------------|
| **Type:**    | bool                  |
| **Default:** | `false`               |

<a id="device-unix-hotplug-device-conf:productid"></a>
`productid`

Product ID of the Unix device

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-hotplug-device-conf:productid)

| **Key:**    | `productid`   |
|-------------|---------------|
| **Type:**   | string        |

<a id="device-unix-hotplug-device-conf:required"></a>
`required`

Whether this device is required to start the container

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-hotplug-device-conf:required)

| **Key:**     | `required`   |
|--------------|--------------|
| **Type:**    | bool         |
| **Default:** | `false`      |

The default is `false`, which means that all devices can be hotplugged.

<a id="device-unix-hotplug-device-conf:subsystem"></a>
`subsystem`

Subsystem of the Unix device

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-hotplug-device-conf:subsystem)

| **Key:**    | `subsystem`   |
|-------------|---------------|
| **Type:**   | string        |

<a id="device-unix-hotplug-device-conf:uid"></a>
`uid`

UID of the device owner in the container

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-hotplug-device-conf:uid)

| **Key:**     | `uid`   |
|--------------|---------|
| **Type:**    | integer |
| **Default:** | `0`     |

<a id="device-unix-hotplug-device-conf:vendorid"></a>
`vendorid`

Vendor ID of the Unix device

[<i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i>](#device-unix-hotplug-device-conf:vendorid)

| **Key:**    | `vendorid`   |
|-------------|--------------|
| **Type:**   | string       |

## Configuration examples

Add a `unix-hotplug` device to an instance by specifying its vendor ID, product ID, and/or subsystem:

```none
lxc config device add <instance_name> <device_name> unix-hotplug vendorid=<vendor_ID> productid=<product_ID> subsystem=<subsystem>
```

See [Configure devices](https://canonical.com/lxd/docs/default/howto/instances_configure/index.html.md#instances-configure-devices) for more information.
