When using Dragonfly in headless mode (no monitor plugged-in) the access to the USB camera is  blocked by Ubuntu. How to solve?

We have found that Ubuntu sometimes locks the access to USB cameras if used in headless mode. It is probably a protection to avoid cameras being used without GUI and without permissione. The trick is to grant access full access to the USB camera by running these commands: