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 have an NTFS partition that I want to automatically mount so I do not have to open Nautilus and click on it under Devices. If I mount with Nautilus, and then type mount, I see the following line:

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

I am the owner of all files and permissions are the way I want them (have umask 077 in .bashrc). However, after following the instructions on MountingWindowsPartitions, and adding the following line to fstab

UUID=4A92C07A92C06C4F /media/Data ntfs-3g defaults,windows_names,locale=en_GB.utf8 0 0

the drive does indeed automatically mount, but all file permissions are -rwxrwxrwx and user and group are both root. The mount command now shows

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

How do I specify the parameters in fstab so that the partition is mounted exaclty the same way as when I click on the device under Devices in Nautilus? I have Ubuntu 12.04.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The fuse mounting done by nautilus has one advantage over system-wide mounts in /etc/fstab: it knows which user is doing the mounting. Assuming you are the only user of your client machine (which is fair enough these days), you can get your numeric UID and GID and default umask with:

$ id
uid=1001(msw) gid=1001(msw) groups=…
$ umask 
0002

then you'd add these to the options group in fstab

defaults,uid=1001,gid=1001,umask=077,windows_names,locale=…

it would be wise, but not required to replace defaults with

auto,rw,nosuid,nodev,noexec

nautilus assumes that a user mounted partition is "untrusted" so flags them this way. A foreign (i.e. NTFS) partition should probably always be viewed with such suspicion.

added in response to comment:

This is an area where cross-system semantics get weird. The mount.ntfs(8) manual defines fmask and dmask to try to make files created on an NTFS filesystem behave better. Can I ls a directory not owned by me under windows? Should I be able to? Is there any relation between your UID on Linux and Windows? Dunno.

There is a usermapping= option for mount.ntfs which supersedes uid, gid, umask, fmask, and dmask. I suggest you look into that if you want fine control on what files are assigned what permissions. I would check to see that you can even access them from the Windows side before committing too much under a usermapping mount.

share|improve this answer
    
Thanks. I followed your advice and replaced the defaults option with your suggestion. One detail remains though. When I create a new file on the mounted drive, it gets the permissions -rwx------ where I would prefer not to have the "x" set (unless it is a directory). Is it the umask=077 that should be changed, and if so, do you know what to change it to? –  DustByte Aug 12 '13 at 9:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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