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 permission. The trick is to grant full access to the USB camera by running these commands:
#List all video devices picked up by Ubuntu in order to find the ID of the USB camera. Please be aware that on Ubuntu 18.04, multiple entries for the same camera can be shown with the command below. The first entry, for a given USB camera, is the one to be used:
ls -ltrh /dev/video*
# grant full access to the USB camera by running this command (where X is the ID of your USB camera):
sudo chmod 777 /dev/videoX