LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Mounting a mp3 player as user? (https://www.linuxquestions.org/questions/linux-general-1/mounting-a-mp3-player-as-user-4175611278/)

JosephS 08-03-2017 11:55 PM

Mounting a mp3 player as user?
 
My question is about mounting a mp3 player.
I had trouble mounting the player as a user so I entered this in /etc/fstab:
Quote:

# sansa clip
UUID=44AD-4794 /media/clip vfat rw,noauto,user,sync 0 0
When I mount it manually it works loading with me as owner of the files and directories. When I plug the player into the usb and it mounts automatically then it loads with root as the owner and I have to use sudo to move anything in or out. Can this be fixed?

Joe

TheEzekielProject 08-04-2017 12:08 AM

Try adding the uid=ownerID and/or gid=ownerGroupID, of the user you want to be able to access it to your /etc/fstab.

You might want to specify the umask as well
Code:

# sansa clip
UUID=44AD-4794 /media/clip vfat umask=0022,gid=gid,uid=uid,noauto,user,sync 0 0


Drakeo 08-04-2017 12:08 AM

your really doing this the wrong way. it should be handle in linux through etc/udev/rules and set up a rule for that device so when it is plugged in the kernel loads it. Like a usb mic. Since you have no name for the device I have no way to find out.
a simple way is you change that fstab and plug it in and run lsusb and dmesg and see what you got. makes some rules for it. find out what the chip is.
Since your able to mount it the kernel module "aka drive" is loading.
as far as copying the stuff off it just do it and have fun.

ondoho 08-04-2017 06:41 AM

if gvfs is installed and working, maybe it should handle that as well?
in combination with a polkit agent, maybe.
gvfs has plugins, maybe there's just one missing that can handle your (which? lsusb?) media player, e.g.: gvfs-mtp

kilgoretrout 08-04-2017 09:27 AM

I think there's nothing wrong with setting this up in fstab vs using udev rules. Since vfat does not have a native permission system like linux filesystems, handling permissions on vfat partitions is different. Different distros handle vfat permission options in the fstab entry a little differently, but the critical item is the umask entry. My Debian 9 vfat partitions have the following entries in fstab in the following form:
Code:

UUID=<partition uuid>  <mount point>    vfat    utf8,users,noauto,umask=007,gid=46  0      0
This was automatically setup by Debian at installation except for the "noauto" option.

The basic setup options I've used when handcrafting vfat entries is:
Code:

vfat user,noauto,exec,defaults,umask=0,rw 0 0
This pretty much worked everywhere and the critical thing is "umask=0". As you've experienced, if you don't have the proper fstab entry, the vfat partition will only be writable by root.


All times are GMT -5. The time now is 02:28 PM.