Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I use auto-mounting of external USB devices, and it works as expected, except that NTFS partitions are mounted with executability flag on. For example:

/dev/sdb1 on /media/Elements type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)

All normal files are -rwxrwxrwx on this partition. I am not happy with the xs. I know I can have it mounted the way I want if I pass the fmask=0111 option.

Now I use Lucid, and suppose it uses some new auto-mounting mechanism (gvfs-mount?), but I don't really know how the default mounting options can be changed now. Gconf settings in /system/storage/default_options/ntfs/mount_options have no effect.

So, how do I make fmask=0111 the default automounting option for all NTFS partitions? (I'd be grateful also if someone explains how the current automounting mechanism works, how to configure it, and if the default mounting options are hard-coded, what I have to recompile to change them).

I know that I can put a line in the /etc/fstab and/or mount manually, but this is not the solution I want, because 1) I don't want to edit /etc/fstab for each and every external drive I use, 2) fstab records appear in the Places pane of Nautilus, even if the drives are not present. The questions is how to change the defaults.

Update: installing udisks 1.0.1+git20100614 or later gives more sensible defaults for NTFS, the problem which remains is how the user can specify arbitrary mount options.

share|improve this question
These are probably related bugs: bugs.launchpad.net/ubuntu/+source/gnome-mount/+bug/78505 bugs.launchpad.net/ubuntu/+source/udisks/+bug/14335 and many duplicates. The problem seems to be solved in udisks 1.0.1+git20100614-1, but it is not available for Lucid yet. –  sastanin Dec 13 '10 at 13:20
Too bad this question was closed. I'm also looking for a way to force specific mount options for specifc automounted filesystems. –  mivk Nov 21 '12 at 21:10
@mivk I also think the closing wasn't appropriate. I was seeking a way to make NTFS drives mount with "windows_names" automatically... –  waldir Feb 8 at 5:40
add comment

closed as too localized by jrg, Jacob Johan Edwards, jokerdino, fossfreedom, Takkat Jan 31 '12 at 21:47

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers

if the default mounting options are hard-coded, what I have to recompile to change them

Edit the file device.c with your custom defaults:

mkdir -p build/udisks
cd build/udisks
apt-get source udisks
gedit udisks-1.0.1/src/device.c

Search for ntfs_defaults, edit, save and exit.
If the mount option isn't already on ntfs_allow list below ntfs_defaults, must also add that new option to ntfs_allow.

Build (see the other answer for a pbuilder way):

cd udisks-1.0.1
dch -l custom "Mount custom defaults fix."
dpkg-buildpackage -b -us -uc -rfakeroot

Install the newly compiled udisk:

sudo dpkg -i ../udisks_1.0.1-1ubuntu1custom1_amd64.deb
share|improve this answer
1) I asked about NTFS, not FAT. 2) I don't see how the proposed patch (15-vfat-UTC.patch) would allow to configure noexec and fmask mount options for NTFS partitions. As is, your answer is offtopic and not useful. –  sastanin Apr 25 '11 at 19:41
@jetxee 1) Look at the line: gedit udisks-1.0.1/src/device.c I don't want to help only you, but as general help. 2) Just an example about how to share your patch against your specific problem. I won't do your homework every time you want to change every other default. Just search for defaults when where in device.c –  Nilfred May 3 '11 at 13:11
1) your "general help" on how to build packages is incomplete, inappropriate and badly written, try to be more specific next time; your last edit at least makes the answer on-topic (+1), but you could have stopped after "new option to allow", without loads of copy-paste 2) I did my homeworks long time ago, and in particular, have already posted a similar workaround, the problem which remains is: it still doesn't allow to specify arbitrary mount options. –  sastanin May 3 '11 at 14:27
@jetxee 1) You should build after edit device.c stoping there left another question open: How to build? 2) I found your self-answer useful to my specific problem, so I give to the community whats community gives to my: I specify arbitrary mount options following your directions (with customs detours) 3) You edited too much: my compile time is much less than yours and install less garbage than pbuilder 4) I agree to remove the share your changes part, that includes the cp -p backup line: apt-get source will undo just fine any fail. –  Nilfred May 5 '11 at 21:36
Agree. Now it is a well-written answer. Thank you. –  sastanin May 6 '11 at 9:43
add comment

I found a workaround for the problem of executable files on Lucid (it shouldn't be required on Maverick). Newer udisks 1.0.1+git20100614 doesn't make all files on NTFS partition executable. This solves my particular problem with executable files, but it still doesn't allow to specify arbitrary mount options.

The following are step-by-step instruction how I built a back-ported udisks package.

Change directory to where you want to download the source packages and download them:

wget https://launchpad.net/ubuntu/maverick/+source/udisks/1.0.1+git20100614-1/+files/udisks_1.0.1+git20100614.orig.tar.gz
wget https://launchpad.net/ubuntu/maverick/+source/udisks/1.0.1+git20100614-1/+files/udisks_1.0.1+git20100614-1.debian.tar.gz 
wget https://launchpad.net/ubuntu/maverick/+source/udisks/1.0.1+git20100614-1/+files/udisks_1.0.1+git20100614-1.dsc 

To build newer udisks I used pbuilder:

sudo aptitude install pbuilder
sudo pbuilder create
sudo pbuilder --update
sudo pbuilder --build udisks_1.0.1+git20100614-1.dsc 

This may take some time but it worked for me. Now you can install the newly built package:

cd /var/cache/pbuilder/result/
ls *.deb
sudo dpkg -i udisks_1.0.1+git20100614-1_amd64.deb

This package should be preferred over the distribution (lucid) packages:

$ apt-cache policy udisks
  Installed: 1.0.1+git20100614-1
  Candidate: 1.0.1+git20100614-1
  Version table:
 *** 1.0.1+git20100614-1 0
        100 /var/lib/dpkg/status
     1.0.1-1ubuntu1 0
        500 http://it.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages
     1.0.1-1build1 0
        500 http://it.archive.ubuntu.com/ubuntu/ lucid/main Packages

Now the regular files on automatically mounted NTFS partitions are not executable anymore. I hope this fix finds its way into the official Lucid updates.

share|improve this answer
add comment

This is because NTFS drives aren't made for linux, they're made for Windows, and Windows makes everything executable by default.

The only way to have them set to non-executable by default is to edit the fstab for each drive, or switch them to fat32.

share|improve this answer
This answers the wrong question. NTFS partitions work well in Linux, and the executable bit can be disabled on all files with fmask=0111 option. The question is how I can I configure the modern Ubuntu automounting mechanism? –  sastanin Dec 13 '10 at 12:51
you can't, read the second paragraph. You would have to switch all of those drives to fat32 to keep them compatible and non-executable by default. –  dkuntz2 Dec 13 '10 at 17:38
Choosing FAT32 or NTFS has nothing to do with setting the fmask. –  Ryan Thompson Dec 13 '10 at 18:32
But by default files on fat32 drives are set to not executable. Hence kind of a solution. –  dkuntz2 Dec 13 '10 at 23:20
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.