著者: Hendrik Boom 日付: To: dng 題目: Re: [DNG] For all you automounter programmers
On Tue, Apr 26, 2016 at 02:08:33PM -0400, Steve Litt wrote: > 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.
I have a USB backup drive. I have root mount it, It's formatted
ext3, and I have no problems doing so. It even allows me to use my
systems's user IDs, though I expect it'll get confused if I were to use
it on several systems with different UIDs.