简体   繁体   English

如何以 root 身份卸载 gphoto2 设备

[英]How to unmount gphoto2 device as root

As a regular user I can see my mounted camera with gio mount ,作为普通用户,我可以看到我安装的带有gio mount摄像机,

user@localhost $ gio mount -l
Volume(0): NIKON DSC D3200
  Type: GProxyVolume (GProxyVolumeMonitorGPhoto2)
  Mount(0): NIKON DSC D3200 -> gphoto2://%5Busb%3A002,007%5D/
    Type: GProxyShadowMount (GProxyVolumeMonitorGPhoto2)
Mount(1): NIKON DSC D3200 -> gphoto2://%5Busb%3A002,007%5D/
  Type: GDaemonMount

But switching to root, it becomes invisible但是切换到root,它变得不可见

root@localhost $ gio mount -l
Volume(0): Filesystem root
  Type: GUnixVolume
  Mount(0): Filesystem root -> file:///
    Type: GUnixMount

So running script as root, I cannot unmount camera with the following command,所以以 root 身份运行脚本,我无法使用以下命令卸载相机,

gio mount -s gphoto2

This is because GIO uses a different backend for enumerating mounts when running as root, because the GVFS daemons which provide (for example) gphoto2 support run in a user session (on the D-Bus session bus) rather than system-wide.这是因为 GIO 在以 root 身份运行时使用不同的后端来枚举挂载,因为提供(例如)gphoto2 支持的 GVFS 守护进程在用户会话(在 D-Bus 会话总线上)而不是系统范围内运行。 So root can't talk to them.所以root不能和他们说话。

Run your script as non-root, or you'll have to do some plumbing to give your script explicit access to your D-Bus session bus (but then it'll only work when your user session is active).以非 root 身份运行您的脚本,否则您将不得不做一些管道工作以使您的脚本显式访问您的 D-Bus 会话总线(但它仅在您的用户会话处于活动状态时才有效)。

You shouldn't need root privileges to list or unmount GIO mounts: permission for that is controlled by polkit, and you should get an authorisation prompt for it if it's not allowed by default.您不应该需要 root 权限来列出或卸载 GIO 挂载:权限由 polkit 控制,如果默认情况下不允许,您应该获得授权提示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM