I am running Ubuntu MATE 16.04 and copying images to and from my internal SD card reader basically works fine… on my main account.
If another family member logs in (my login still active in the background, not logged out) and then inserts an SD card, he can't access it:
So, is this some kind of rights issue...? Logging back in as the main user, I also see some rights issues:
So, whatever it is, how can I loosen up access rights on the SD card reader, so it becomes accessible to everyone (including non-admin users)?
Perhaps some ‘relaxed’ etc/fstab
entry? (no related entry there yet)
Update I:
Switching back & forth between 2 SD cards (from a single user) and looking at /dev/disk/by-id
:
?> ~ $ ll /dev/disk/by-id | grep mmc
... mmc-SDU1_0x02400f04 -> ../../mmcblk0
... mmc-SDU1_0x02400f04-part1 -> ../../mmcblk0p1
?> ~ $ ll /dev/disk/by-id | grep mmc
... mmc-SE32G_0x0072e5ab -> ../../mmcblk0
... mmc-SE32G_0x0072e5ab-part1 -> ../../mmcblk0p1
?> ~ $ ll /dev/disk/by-id | grep mmc
... mmc-SDU1_0x02400f04 -> ../../mmcblk0
... mmc-SDU1_0x02400f04-part1 -> ../../mmcbl
?> ~ $ ll /dev/disk/by-id | grep mmc
... mmc-SDU1_0x02400f04 -> ../../mmcblk0
... mmc-SDU1_0x02400f04-part1 -> ../../mmcblk0p1
?> ~ $ ll /dev/disk/by-id | grep mmc
... mmc-SE32G_0x0072e5ab -> ../../mmcblk0
... mmc-SE32G_0x0072e5ab-part1 -> ../../mmcblk0p1
?> ~ $ ll /dev/disk/by-id | grep mmc
... mmc-SDU1_0x02400f04 -> ../../mmcblk0
... mmc-SDU1_0x02400f04-part1 -> ../../mmcblk0p1
../../mmcblk0[p1]
⇒ /dev/mmcblk0[p1]
seems to be the only constant here. Perhaps I can get a solution with this?
I added this to /etc/fstab
(according to man page, the first param may also be a device path, if I understand correctly):
/dev/mmcblk0p1 /media/ExtSD01/ auto auto,user,rw 0 0
This worked somewhat nicely, now that I can mount /dev/mmcblk0p1/
and unmount to the user-neutral path, not automatically but at least from command line (disadvantage 1). However my system hang an reboot – unless I have an SD card inserted before boot (disadvantage 2). So I removed that line again…
Maybe there's another place to edit mount options in Ubuntu Mate? system.d? Elsewhere?
To mount SD card at startup for all users, we need an entry in the
fstab
file. What is happening presently is, the SD card is getting mounted for the user who logs in which gives access permissions to only that user. By adding an entry in the fstab, the SD card will be mounted by root with access to all users. this r/w access can be controlled later on.sudo blkid
lists down all partitions(including of your SD card) available on your system. Note down theUUID
of the partition that you want to mount at boot.now create a folder, for example
sudo mkdir /media/ExtSD01
. This is the folder where your SD card partition will be mounted at. This folder will be owned by root. To give other users permission to r/w into this folder we need to give the proper permissions. sochmod -R 777 /media/ExtSD01
would be good enough. Now you need to edit your fstab file. to do so, type the following command.go to the bottom of the file and add the following line there.
Reboot system and you should be good to go.
What about not having the USB drives automount when they are connected. In which case, you can manually mount them as you wish. To disable automount, use dconf-editor and go to org/gnome/desktop/media-handling and disable automount by setting it to false. Then manually mount the SD card to a folder with the permissions set as you wish.
You could try to add a new group called sdcard and write a udev rule for your sd cards.
Let's start with the easy part and create a new group:
Now add the user(s) to the sdcard group:
Now we have to dig for additional information about the sd card(s) you are using.
We need a product name or product id and a vendor name or vencor id
plug in your sd card and type
In my case it is /dev/sda.
I know your device names are different, but for simplicity I will refer to the sd card as /dev/sda.
Search your devices for the desired information using
These additional commands could help you finding the vendor and product:
lsusb
usb-devices
dmesg
In my case lshw provided the following information:
As you can see my product is USB2.0-CRW and vendor is Generic.
You can now create a file in /etc/udev/rules.d/ and call it i.e. 10-sdcard.rules
This will add the device node for the sdcard and provide read and write permission to the sdcard group.
If you find a product id (i.e. 1234) or vendor id (i.e. abcd) instead of product name and vendor name use
ATTRS{idProduct}="1234", ATTRS{idVendor}="abcd"
.If your two sd cards have the same vendor id/name and product id/name this one line should be sufficient. If not add an additional line providing the information for the other sd card.
The users in the sdcard group should now be able to mount the sd cards.
You added this to
/etc/fstab
(according to man page, the first param may also be a device path, if I understand correctly):Assuming you have a Microsoft file system (NTFS, FAT32 or exFAT) in the SD card, I suggest the following modifications:
Replace the mount option
auto
withnoauto
to make the system boot nicely without an SD card inserted.Disadvantage: You must mount the drive manually, which you can do very easily, and it will be mounted according to the line in
/etc/fstab
,If you wish, you can make an alias for it,
Add the mount option
umask
to provide the desired permissions for all usersThe result is the following line in
/etc/fstab
,See the following link, if you want to fine-tune the mount options,
How do I use 'chmod' on an NTFS (or FAT32) partition?