/dev/video0 accessible as root only

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
neilyoung
Posts: 6
Joined: 17. Jun 2021, 21:07

/dev/video0 accessible as root only

Post by neilyoung »

Hi,

I'm running an Ubuntu 20.04 Server guest in my VB 6.1 on macOS Big Sur. I'm forwarding a USB camera into the VM.

ls -lall /dev/video0
crw-rw---- 1 root video 81, 0 Oct 17 15:57 /dev/video0

Running a GStreamer pipeline using this camera is only possible if using "sudo". I can temporarily assign myself to be the owner of this device, but this is changed again to root on unplug/plug.

Is there any way to have non-root access to this device permanently?
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: /dev/video0 accessible as root only

Post by scottgus1 »

The method you're using does not sound like a Virtualbox method. See https://www.virtualbox.org/manual/ch09. ... assthrough for the Virtualbox method. This should not require sudo.
neilyoung
Posts: 6
Joined: 17. Jun 2021, 21:07

Re: /dev/video0 accessible as root only

Post by neilyoung »

What do you mean? What method?
neilyoung
Posts: 6
Joined: 17. Jun 2021, 21:07

Re: /dev/video0 accessible as root only [SOLVED]

Post by neilyoung »

Ok, disregard.

I had to install VB Extension on the guest:

sudo apt install virtualbox-ext-pack

Then I added myself to the group vboxusers:

sudo usermod -a -G vboxusers ubuntu

Logged out/in.

After that I was able to open this pipeline as non-root:

gst-launch-1.0 v4l2src device=/dev/video2 ! video/x-h264,profile=constrained-baseline,width=1920,height=1080,framerate=30/1 ! h264parse ! rtph264pay config-interval=1 ! application/x-rtp,media=video,encoding-name=H264 ! fakesink
Post Reply