Ubuntu – How to access drives that are mounted by other users

mountpermissionsusers

On my PC, I have three user accounts. Suppose I open a drive from the file manager in one account, it gets mounted and can be accessed fine. But when I try to access the same drive from another account, it appears as already mounted, but trying to open it results in the following error:

You do not have the permissions necessary to view the contents of “My Videos”.

I know that I can do

sudo umount

and then

sudo mkdir
sudo mount

But, is there any permanent fix?

Best Answer

  • This is happen because when a device is mounted is mounted under your name and so, the system think that is yours and only you should have access to it. To pass by this you can simply unplug and plug again that device when you switch to another account, or...

    From this output:

    total 0 
    lrwxrwxrwx 1 root root 10 Oct 2 18:34 3C18F90318F8BD48 -> ../../sdb3 
    lrwxrwxrwx 1 root root 10 Oct 2 18:34 5e89f82b-dea9-4348-88f9-ac5cd533437f -> ../../sdb9
    lrwxrwxrwx 1 root root 10 Oct 2 18:34 648660B6866089FE -> ../../sda2 
    lrwxrwxrwx 1 root root 10 Oct 2 18:34 8012db19-0086-4576-96a2-34f50a75ecfb -> ../../sdb8 
    lrwxrwxrwx 1 root root 10 Oct 2 18:34 88EAB7AEEAB796C2 -> ../../sdb6 
    lrwxrwxrwx 1 root root 10 Oct 2 21:23 8AD65635D65621AD -> ../../sdb2 
    lrwxrwxrwx 1 root root 10 Oct 2 18:34 96C01076C0105EB5 -> ../../sda3
    

    I can understand that you have probably more than one device plugged. Let's take for example sdb2 - it was the last one plugged. It's UUID is 8AD65635D65621AD - keep this in mind.

    First, make a group called let say my_device (you can call it whatever else) and add your accounts to it. You will do these from terminal:

    sudo groupadd my_device
    sudo usermod -a -G my_device your_username
    sudo usermod -a -G my_device another_username
    #...
    sudo usermod -a -G my_device last_username
    

    Second, make a new folder called my_device in /media and give everyone in the my_device group permission to read and write it:

    sudo mkdir /media/my_device
    sudo chown :my_device /media/my_device
    sudo chmod 660 /media/my_device
    

    Finally, open fstab as root. Something like:

    sudo -i gedit /etc/fstab
    

    and add this line at the end:

    UUID=8AD65635D65621AD    /media/my_device    vfat    users,noauto,relatime    0  0
    

    Save the file and close it. That's it

    The same method can be applied for other devices.

    Source: http://ubuntuforums.org/showthread.php?t=1684055

  • Related Question