![网络摄像头可以以 root 身份工作,但不能以普通用户身份工作:我需要更改哪些权限?](https://linux22.com/image/1195234/%E7%BD%91%E7%BB%9C%E6%91%84%E5%83%8F%E5%A4%B4%E5%8F%AF%E4%BB%A5%E4%BB%A5%20root%20%E8%BA%AB%E4%BB%BD%E5%B7%A5%E4%BD%9C%EF%BC%8C%E4%BD%86%E4%B8%8D%E8%83%BD%E4%BB%A5%E6%99%AE%E9%80%9A%E7%94%A8%E6%88%B7%E8%BA%AB%E4%BB%BD%E5%B7%A5%E4%BD%9C%EF%BC%9A%E6%88%91%E9%9C%80%E8%A6%81%E6%9B%B4%E6%94%B9%E5%93%AA%E4%BA%9B%E6%9D%83%E9%99%90%EF%BC%9F.png)
当我cheese
以 root 身份运行时,我可以正常看到来自网络摄像头的视频流。但是,当我以普通用户身份运行时,我收到“未找到设备”的提示。有问题的普通用户位于对相关设备文件具有读写权限的组 (video) 中/dev/video0
。请问我如何以普通用户身份获得网络摄像头访问权限?
以 root 身份运行的输出cheese
是:
(cheese:5512): GLib-GObject-CRITICAL **: 14:43:01.263:
g_value_dup_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
(cheese:5512): GLib-GObject-CRITICAL **: 14:43:03.915:
g_value_dup_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
root@verderer:~# cheese
(cheese:5786): GLib-GObject-CRITICAL **: 14:58:42.863:
g_value_dup_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
(cheese:5786): GLib-GObject-CRITICAL **: 14:58:45.498:
g_value_dup_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
cheese
以普通用户身份运行的输出是:
(cheese:5650): Gdk-WARNING **: 14:47:18.091: Native Windows taller
than 65535 pixels are not supported
** Message: 14:47:18.151: cheese-application.vala:222: Error during camera setup: No device found
(cheese:5650): cheese-CRITICAL **: 14:47:18.185:
cheese_camera_device_get_name: assertion 'CHEESE_IS_CAMERA_DEVICE
(device)' failed
(cheese:5650): GLib-CRITICAL **: 14:47:18.185: g_variant_new_string:
assertion 'string != NULL' failed
(cheese:5650): GLib-CRITICAL **: 14:47:18.185: g_variant_ref_sink:
assertion 'value != NULL' failed
(cheese:5650): GLib-GIO-CRITICAL **: 14:47:18.185:
g_settings_schema_key_type_check: assertion 'value != NULL' failed
(cheese:5650): GLib-CRITICAL **: 14:47:18.185:
g_variant_get_type_string: assertion 'value != NULL' failed
(cheese:5650): GLib-GIO-CRITICAL **: 14:47:18.185:
> g_settings_set_value: key 'camera' in 'org.gnome.Cheese' expects type's', but a GVariant of type '(null)' was given
(cheese:5650): GLib-CRITICAL **: 14:47:18.185: g_variant_unref:
assertion 'value != NULL' failed
** (cheese:5650): CRITICAL **: 14:47:18.185: cheese_preferences_dialog_setup_resolutions_for_device: assertion
'device != NULL' failed
答案1
查看相机的所有权和权限:ls -l /dev/video*
。请注意,它允许rw
组成员访问video
。
使用以下命令将您自己添加到video
组中:
sudo adduser $USER video
login
然后完全注销并登录。组成员身份通过(和newgrp
命令)应用。