Related:
If you see the following error, you have a permissions problem:
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
Add to udev rules:
# STLink v2
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", MODE="660", GROUP="plugdev", TAG+="uaccess"
Set up udev rules
# DFU (Internal bootloader for STM32 MCUs)
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="5740", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev", ENV{ID_MM_DEVICE_IGNORE}="1"
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev", ENV{ID_MM_DEVICE_IGNORE}="1"