[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to override fuse args to ntfs-3g to set permissions?



On 29 November 2014 at 17:06, Rick Macdonald <rickmacd@shaw.ca> wrote:
> On 28/11/14 05:21 PM, Scott Ferguson wrote:
>> On 28 November 2014 at 16:08, Rick Macdonald <rickmacd@shaw.ca> wrote:

>>>>>>>> On 25/11/14 08:46 PM, Scott Ferguson wrote:
>>
<snipped>
>>
>
> Hey, thanks for all this!

No worries. Thanks for the feedback.
>
> I created a thumb drive for testing. Using the actual drive takes too long,
> as the cable is awkward, the drive spins up and down, etc.
>
> I added my uid/gid to the rule for jollies, so it mounts as me instead of
> root.

I'm uncertain of the advantage if you are a member of user. You can
use the USER tag in the rule to run commands as someone other than
root.

> Plex should work in either case with wide-open 777 mode.
>

Agreed

> ACTION=="add", PROGRAM=="/sbin/blkid -o value -s TYPE /dev/%k",
> RESULT=="ntfs",
> ENV{mount_options}="%E{mount_options},utf8,uid=1000,gid=1000,umask=000"

Oddly uid=N and gid=N in the ntfs-3g man (rather than uid=nnnn and
gid=nnnn) I'm not sure if that's why mount | grep $SomeNTFSSlice
reports single digit uid and gid.... [puzzled]

>
> There was a problem in the dir_name,

Could you expand on that?

> so I changed these two lines:
>
> #ACTION=="add", PROGRAM=="/sbin/blkid -o value -s TYPE %E{device}",
> RESULT=="ntfs",
> ENV{mount_options}="%E{mount_options},utf8,gid=100,umask=002"
> ACTION=="add", PROGRAM=="/sbin/blkid -o value -s TYPE /dev/%k",
> RESULT=="ntfs",
> ENV{mount_options}="%E{mount_options},utf8,gid=100,umask=002"

What do you get from "mount -L | grep Win"?

> # Get label if present, otherwise assign one
> #PROGRAM=="/sbin/blkid -o value -s LABEL %E{device}", ENV{dir_name}="%c"
> PROGRAM=="/sbin/blkid -o value -s LABEL /dev/%k", ENV{dir_name}="%c"
>
> When I unmount the drive, the directory is not deleted. The
> owner/permissions change from me/777 to root/755. I see you have commands
> for umount and rmdir ("Clean up after removal"), but I'm not sure what is
> meant to kick those off.

That /media/$NFTSSliceLABEL dir will remain. That the notoriously
fickle NTFS 'might' be damaged if the mounted NTFS device is suddenly
removed (more likely you might just get into a futile tug-of-war).
Belt and suspenders?

> I pulled out the drive without umounting first, not
> that I think you had that in mind, but that didn't change the behaviour
> (much).

Did a program have access to that file system at the time?

>
> It seems that only root can umount the drive, but I've seen mention of that
> for NTFS, or maybe it was udisks in general?

NTFS-3G. After digging through policy kit it 'seems' if a non-root
user who is not a member of the disk group wants to umount NTFS they
need to recompile ntfs-3g with build-in FUSE and then setuid the
resulting binary.

>
> Almost there!

Lots of room for improvement - if I had time I'd refine the rule to
*only* apply to a unique NTFS slice, and figure out a way so that the
slice icon that appears on XFCE desktop and in the sidebar of Thunar
*is* the mounted NTFS slice.

An alternative approach to solving the above two niggles would be to
hide the dysfunctional icons, and automagically (using udev) add an
icon to the desktop - which when clicked would umount the (WinBackup)
slice (gksudo or similar - if you use sudo that wouldn't be
necessary).

>
> Regards,
> Rick
>

Kind regards


Reply to: