As a regular user I can see my mounted camera with 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@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,
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. So root can’t talk to them.
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).
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.