I'm using Ubuntu mate 20.04 at the moment. I have 2 users on the system. User A would auto login to the desktop and user B is for remote VNC access, I installed tigervnc server on the system. Both users are administrator in the system at the moment.
Now I have a problem with USB device,when I plug a USB disk to the computer, the local user A won't be able to mount the USB device, instead I have to use VNC viewer to login as user B and mount it with password. Or if I cancel the authentication for mounting the USB device from vnc viewer then USB would be mounted automatically on user A's desktop.
I cannot understand why the system is doing this. This doesn't make any sense, I never had this issue with Linux Mint before as it would always let the current desktop user mount the USB device, the user on vnc server shall not have a higher priority over the USB devices.
Can anyone help me with this please? Is there a way to change the priority on usb devices? I want user A to be the one that can always mount the USB device first. Or is it possible to disallow USB devices to be mounted on the vnc server?
1st. On desktop navigate to Menu > Users and Groups > User B> Advanced Settings > User Privileges. Uncheck "Access external storage devices automatically". So the remote user B won't try access the USB disk automatically.
2nd. Modify this file: /usr/share/polkit-1/actions/org.freedesktop.UDisks2.policy
This is the file that configure all device authorizations, I changed the default setting for mounting/ejecting external devices to "yes" instead of "auth_admin":
Guys, just found a better way here without editing the default USB policy.
To disable my remote user B auto-mount / auto-open USB devices, check the auto-mount setting first: $gsettings list-recursively org.mate.media-handling
Then change the settings: $gsettings set org.mate.media-handling automount false $gsettings set org.mate.media-handling automount-open false
From now on, anything that's plugged into the system would be auto-mounted to user A's desktop. Done.
I did something else as sometimes I might need to access those USB devices as user B: $sudo chown -R userB /media/ $sudo chown -R userB /media/.
After this I can access the USB devices even if it's mounted by user A.
Cheers!
@Penn
Thanks! I plug/unplug USBs all the time to format them and auto-mount was a problem for me.
But then, what is the Access external storage devices automatically tick-box for? I firstly unticked this, but the USB-flash auto-mounted. Using GUI is important for many including me.
Hi Vasilis, I think the Access external storage devices automatically tick-box is for the desktop user to decide whether the USB disk should be auto-opened in the file explore (caja) when plugged in.
That option is quite useful if you have only one user (administrator) on the system. The USB disk would always be mounted on the single user's desktop environment, you can decide whether it would be automatically opened in caja by checking/unchecking the Access external storage devices automatically tick-box
Problem is when you have more than one user, the USB disk could be automatically mounted under a different user's desktop environment, the Access external storage devices automatically tick-box might not work if you logged as other users. Which is why you'd better manager the USB access rights by editing the auto-mount settings first. Cheers.