:: [DNG] For all you automounter progr…
Página Inicial
Delete this message
Reply to this message
Autor: Steve Litt
Data:  
Para: Dng
Assunto: [DNG] For all you automounter programmers
Hi all,

It seems like everyone in the Devuan community has written his or her
own usb drive automounter, and I've just discovered something that will
help us all.

The thumb drive you buy at the store is formatted with a Windows file
system, and that's a good thing because it's mountable pretty much by
any device or computer. Sneakernet at its best.

But you must be root to mount it unless it's declared in /etc/fstab,
which is a bad idea for a number of reasons. And if you mount it as
root, normally the owner is root, and with its (typical) 755
permissions, a normal user can't write to it. Defeating its whole
purpose.

What you really want is for anyone in a certain group to be able to
write to it. I used group "floppy", because a USB drive is a pretty
good analog to a floppy, and floppies aren't even used much anymore. So
do the mount like this:

mount -o gid=floppy,fmask=113,dmask=002 /dev/sdd1 /mnt/thumb

or

mount -o gid=floppy,fmask=113,dmask=002 /dev/sdd1 /mnt/sdd1

The gid= means the thumb drive and all its files are group "floppy",
and the fmask and dmask make directories 775 and 664 respectively, so
group "floppy" can write.

I haven't yet tried this on a genuine ext4 formatted thumb drive, so I
don't know whether it would have any downside there. If so, the
different mount options would only appear if the thumb drive was
determined to be vfat/fat/msdos etc.

SteveT

Steve Litt
April 2016 featured book: Rapid Learning for the 21st Century
http://www.troubleshooters.com/rl21