Webcam Permissions Reset on Boot – Fix for Ubuntu 22.04

22.04permissionswebcam

I can only access my webcam(s) with sudo rights with cheese.

ls -l /dev/video0

outputs:

crw-rw----+ 1 root video 81, 0 Nov 13 15:18 /dev/video0

same for video1.
When setting

sudo chmod 666 /dev/video*

(or 660) changes are accepted

crw-rw-rw-+ 1 root video 81, 0 Nov 13 15:18 /dev/video0
crw-rw-rw-+ 1 root video 81, 0 Nov 13 15:18 /dev/video1

However this does not change the fact, that cheese does only find webcam(s) when run with sudo rights. When rebooting, the old permissions on video* are reset to what they were before.
I also added my user to the group video. This however survives a reboot but does not solve my issue.

Best Answer

Rather than your current approach, add yourself to the video group. Do:

device="/dev/video0"
sudo adduser $USER $(stat -c "%G" $device)

This allows you membership in the group that can rw the device, but there is one more step.

To make all your processes members of the new group, logout and login. Group memberships are set up at login time.

To create a single process in the new group (for testing, prior to logout/login):

newgrp $(stat -c "%G" $device)  

See man newgrp.

Related Question