← Back to team overview

desktop-packages team mailing list archive

[Bug 1153781] Re: Can not run .exe .com and .bat from NTFS formated USB flash drive

 

Launchpad has imported 9 comments from the remote bug at
https://bugs.freedesktop.org/show_bug.cgi?id=33461.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2011-01-25T05:52:30+00:00 Olivier Fourdan wrote:

Created attachment 42455
Proposed patch (against current git)

gnome-mount had a feature to specify mount options per file system types
(via GConf key "/system/storage/default_options/<fs
type>/mount_options") that could be used to restrict read-only mount of
removable devices from the desktop.

I could not find something similar with udisks (maybe it's there but I
could not find it) so I wrote the attached patch to add this feature.

Basically, udev sets a property UDISKS_MOUNT_OPTIONS (coma separated
list of options to pass to mount) that is read by udisk-daemon and
appended to the options used to mount the device.

The idea is to allow sysadmins to force some mount options on some
devices, for example "ro,noxec" on USB sticks.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/udisks2/+bug/1153781/comments/0

------------------------------------------------------------------------
On 2011-01-27T05:12:01+00:00 Olivier Fourdan wrote:

There is a DBUS mechanism to pass mount options to udisks-daemon (used
by udisks, the command line tool) but that may not really be what is
needed here.

To get the desired mount options to be applied, that would require to
implement the functionality in every desktop/file manager which may use
usdisks (instead of forcing the options in udisks-daemon as done with
the proposed patch).

Also, a user may use the udisks command directly without specifying the
mount options to get the mount in read-write mode.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/udisks2/+bug/1153781/comments/1

------------------------------------------------------------------------
On 2011-01-27T08:43:02+00:00 Zeuthen wrote:

If you look at the FSMountOptions structure

 http://cgit.freedesktop.org/udisks/tree/src/device.c?id=1.0.2#n5843

then there are two arrays: defaults and allow. I think it would make
sense to control both on a per-device basis via udev via, say.
UDISKS_MOUNT_OPTIONS and UDISKS_MOUNT_OPTIONS_ALLOW. The former would be
appended to the existing mount options (as you suggest) and the latter
would be replacing it (to allow complete lockdown).

Then your use case will be just setting

 UDISKS_MOUNT_OPTIONS="ro,noexec"

Regarding the patch: I don't think we need to expose this a D-Bus
property. Also, the patch should also include a modification to the
udisks(7) man page.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/udisks2/+bug/1153781/comments/2

------------------------------------------------------------------------
On 2011-01-27T08:53:12+00:00 Zeuthen wrote:

Btw, the docs will have to be very careful about emphasizing that
whatever the user set the properties to, may be filesystem dependent. An
example like this might suffice

 # use specific charset for FAT filesystems
 #
 ENV{ID_FS_TYPE}=="vfat", ENV{UDISKS_MOUNT_OPTIONS}="utf8=0,iocharset=iso8859-15"

and the USB example in your patch is too encompassing (it sets the
property on too many devices). It should be something like this

 # mount all USB devices RO
 #
 SUBSYSTEMS="usb", ENV{ID_FS_USAGE}=="filesystem", ENV{UDISKS_MOUNT_OPTIONS}="ro"

instead (and even this may be too wide - for example, the disk
controller may be USB but the disk itself is something else. But that's
unimportant.)

Reply at:
https://bugs.launchpad.net/ubuntu/+source/udisks2/+bug/1153781/comments/3

------------------------------------------------------------------------
On 2011-02-16T01:12:10+00:00 Olivier Fourdan wrote:

Sorry for the delay (got busy with other stuff), thanks a for the
feedback! I am working on a new patch based on comment #2

Reply at:
https://bugs.launchpad.net/ubuntu/+source/udisks2/+bug/1153781/comments/4

------------------------------------------------------------------------
On 2011-02-16T06:32:25+00:00 Olivier Fourdan wrote:

(In reply to comment #2)
> If you look at the FSMountOptions structure
> 
>  http://cgit.freedesktop.org/udisks/tree/src/device.c?id=1.0.2#n5843
> 
> then there are two arrays: defaults and allow. I think it would make sense to
> control both on a per-device basis via udev via, say. UDISKS_MOUNT_OPTIONS and
> UDISKS_MOUNT_OPTIONS_ALLOW. The former would be appended to the existing mount
> options (as you suggest) and the latter would be replacing it (to allow
> complete lockdown).

So I have implemented the UDISKS_MOUNT_OPTIONS_ALLOW which replaces the
allow[] array set in the various FSMountOptions predefined structures
(depending on the filesystem type), but then I am facing a problem
because if the mount options defined in the defaults[] array are not
listed in the allow[] one, then the mount is denied ("Mount option is
not allowed").

For example, vfat_defaults[] lists the option "showexec". imagine a
sysadmin does not want that option to be allowed, (s)he would not list
that option in UDISKS_MOUNT_OPTIONS_ALLOW but then all devices using
vfat will be denied the right to be mounted (which is not what most
people want, I guess most people would want to use only the elements in
the intersection of the two sets,  {defaults[] ∪ mount_options[]} ∩
allow[] if that makes any sense :)

So I'll probably propose the two patches, yet I believe
UDISKS_MOUNT_OPTIONS_ALLOW would be used to filter out the options that
a sysamin does not want to be used (ie if not listed in
UDISKS_MOUNT_OPTIONS_ALLOW, it is not passed to mount, rather than not
allowing the mount).

> Regarding the patch: I don't think we need to expose this a D-Bus
property.

Oops, sorry I can't find where it is exposed via D-Bus.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/udisks2/+bug/1153781/comments/5

------------------------------------------------------------------------
On 2011-02-16T08:37:47+00:00 Olivier Fourdan wrote:

Created attachment 43436
Updated patch

That the patch I am not too happy with. Basically, if an option is used
while not listed in UDISKS_MOUNT_OPTIONS_ALLOW (if set, of course) then
the mount is rejected.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/udisks2/+bug/1153781/comments/6

------------------------------------------------------------------------
On 2011-02-16T08:41:24+00:00 Olivier Fourdan wrote:

Created attachment 43437
Another proposed patch

This is the 3rd approach, which I think is better,
UDISKS_MOUNT_OPTIONS_ALLOW is used as a filter, if an option is used but
not listed in UDISKS_MOUNT_OPTIONS_ALLOW (if set, of course), then that
option is ignored yet the mount is performed.

This allows the sysadmins to specify the exact subset of mount option to
be allowed, so that options such as "showexec", for example, which is
set by default on vfat can be filter out if needed.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/udisks2/+bug/1153781/comments/7

------------------------------------------------------------------------
On 2011-10-27T10:53:54+00:00 Orion-cora wrote:

This looks pretty stalled.  I really need to be able to turn off
"showexec" on out vfat mounts.  Any hope for this in the future?

Reply at:
https://bugs.launchpad.net/ubuntu/+source/udisks2/+bug/1153781/comments/8


** Changed in: udisks
       Status: Unknown => Confirmed

** Changed in: udisks
   Importance: Unknown => Wishlist

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to udisks2 in Ubuntu.
https://bugs.launchpad.net/bugs/1153781

Title:
  Can not run .exe .com and .bat from NTFS formated USB flash drive

Status in NTFS-3G:
  New
Status in abstraction for enumerating and managing block devices:
  Confirmed
Status in “udisks2” package in Ubuntu:
  Triaged

Bug description:
  1. Description of the problem:

  Currently NTFS formated USB flash drives do not have the exec bit for
  {exe,com,bat}.  Use of NTFS makes more sense for some users , as pen
  drives tend to have larger capacities than earlier .

  "vfat" support 'showexec' mount option, which is currently not
  implemented on ntfs-3g.

  The use case is necessary when we have applications that are multi
  platform.

  2. How reproducible is the problem?
  Always. Format a usb key with NTFS and copy some .exe files. Insert it to the usb port and let Nautilus open it.
  Files won't have the +x bit enabled.

  drwxr-x---+ 4 root   root   4096 Mar 11 16:11 ..
  -rw-------  1 user1 user1   29 Mar  8 14:20 aaa.exe

  3. Workaround
  You can umout and mount manually with the following command. But it defeats the purpose of having proper permissions from the start.

  sudo mount -t auto /dev/sda1 /media/lborda/

  
  4. Additional info:

  * ntfs-3g allows for exec mount option, which enables execute bit for all files. 
  * We would also need to enable "showexec" bit in udisk for ntfs, or allow for https://bugs.freedesktop.org/show_bug.cgi?id=33461

To manage notifications about this bug go to:
https://bugs.launchpad.net/ntfs-3g/+bug/1153781/+subscriptions