How to set default permissions for automounted FAT drives in Ubuntu 9.10?
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Ocean Floor
--
Chapters
00:00 How To Set Default Permissions For Automounted Fat Drives In Ubuntu 9.10?
00:59 Answer 1 Score 0
01:15 Accepted Answer Score 7
02:54 Answer 3 Score 1
03:32 Answer 4 Score 0
04:04 Thank you
--
Full question
https://superuser.com/questions/134438/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#ubuntu #permissions #fat32 #automount
#avk47
ACCEPTED ANSWER
Score 7
Updated
Unfortunately there is no built-in means to do this. The "right way", the supported way, is setting an /etc/fstab line with the default mount options you want. This means your defaults must be set per-device, though you can use the partition label or UUID to avoid requiring a specific device path. In particular, this method seems to take place before the PolicyKit desktop authorization.
The Ubuntu forums, Launchpad and Gnome's bugzilla have many posts from users looking for the same functionality you're looking for, on both NTFS and FAT32. Ubuntu 9.10 and 10.04 provide the default automounting via a combination of DeviceKit-Disks, GVFS, and Nautilus.
DeviceKit-disks provides a FilesystemMount interface whose options argument appears to be the proper way to configure your mount options. But GVFS/Nautilus does not appear to provide any means, via the UI or a configuration file, to specify this option when automounting a USB key.
There are a couple of workarounds:
This Launchpad bug contains a user-provided patch that alters the DeviceKit-Disks defaults in a custom-built devicekit-disks package.
On the plus side, this may be the easiest way to set your preferred defaults for all devices. The disadvantage is that you'll need to repatch again when the package is updated.
One Ubuntu Forums post proposes a device-specific workaround script:
#!/bin/bash devkit-disks --unmount /dev/disk/by-uuid/0D3594370C618A2A devkit-disks --mount-options "dmask=000" --mount /dev/disk/by-uuid/0D3594370C618A2A
This is also sub-optimal, since you'd have to keep this updated with specific devices. But it does avoid the authorization problem that the supported fstab solution can have.
ANSWER 2
Score 1
Here's my fstab line for getting my usb stick to mount with permissions suitable for a private ssh key (fmask=177). Trial and error informed me I had to add the 'user' option to get automount to work.
/dev/disk/by-uuid/C2F8-E4F2 /media/TIM_ABELL vfat rw,user,nosuid,nodev,dmask=0077,flush,fmask=177
I also had to create the mount point which was previously automatic:
mkdir /media/TIM_ABELL
the disk uuid can be found by plugging in the disk and running
mount
ls -l /dev/disk/by-uuid/
which will allow you to get the mount point -> device -> uuid mapping
ANSWER 3
Score 0
Have you really, really tried the old /etc/fstab method? It works for me. Ubuntu uses fstab, no matter of the HAL automounter.
ANSWER 4
Score 0
I did some bash scripting and came out with this improved version of the workaround script that is posted above:
#!/bin/bash
dev_path="/dev/disk/by-id"
usb_drives=$(find $dev_path -name "usb*")
mount_options="utf8=0,codepage=850,iocharset=iso8859-1"
for dev in $usb_drives ; do
if ( devkit-disks --show-info $dev | \
grep "is mounted:" | grep -q 1 ) ; then
devkit-disks --unmount $dev
devkit-disks --mount $dev \
--mount-options $mount_options
fi
done
It finds every devices connected by USB (hopefully all pendrives) which are already mounted, and remounts them using mount_options (in my case, let them use iso-8859-1 charset for compatibility with other limited OSes)