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.

After a nasty episode (my second, you'd think I'd learn) caused by unsupervised automated podcast downloads filling my entire partition, I've finally moved just ~/Music to its own partition. The partition I'm using was already formatted NTFS (this is the genius part: when I got this computer three years ago, I actually set it up with a 20G music partition precisely because I'd had this problem before, but I never actually organized myself to store music on it. So that's my backstory. Here's what I need now:

I have two partitions that I want to start mounting on startup:

/dev/sda3   /mnt/devel  ext4    defaults    0   2
/dev/sda2   /mnt/excess ntfs    defaults    0   2

The ext4 partion mounts fine (owned by me, writeable only by me), but the ntfs mounts owned by root with read and write permission for all. I'm not sure how to fix this. Is there something quirky about ntfs or did I do something elsewhere that's causing this problem?

drwxr-xr-x  7 amanda amanda 4096 2012-03-14 19:07 devel
drwxrwxrwx  1 root   root   4096 2012-03-14 22:38 excess
share|improve this question
    
The options "noatime" or "relatime" is available and recommended for permanent ntfs mounting (see man mount.ntfs). I had some hdd busy-ness problems with ext3/4 and ntfs too! –  user259044 Mar 17 at 4:13
add comment

3 Answers

up vote 18 down vote accepted

Permissions for ntfs and vfat file systems must be set with the dmask, fmask and umask options. dmask controls permissions for directories, fmask controls permissions for files, and umask controls both. Since these options set masks, they should be the compliment of the permissions you want. For example, rwx for the owner and rw for others is 022 rather than 755.

To set the owner, use the uid and gid options for user and group, respectively. You can find your UID with the command echo $UID. To find your GID, use cat /etc/group. These values are both usually 1000.

A common set of mount options for ntfs is uid=1000,gid=1000,dmask=027,fmask=137. This sets you as the owner of the drive, and sets the permissions to drwxr-x---.

share|improve this answer
    
help.ubuntu.com/community/Fstab#ntfs –  Amanda Mar 17 '12 at 14:52
    
That is indeed the source of much of the above. I also included some more detailed explanations of how the *mask options work. –  bessman Mar 17 '12 at 14:56
    
Thanks. The "mask" part of masking threw me for a loop. 111 gets you -rw-rw-rw- not ---x--x--x –  Amanda Mar 17 '12 at 20:07
    
You can also use the id command to find your UID and GID. –  Sandeep Datta Nov 3 '13 at 16:48
    
Could you possibly provide a more complete example showing those options used in a line from /etc/fstab –  puk Nov 15 '13 at 3:34
add comment

If you mount the ntfs partition with the permissions option, then chmod / chown will work

/dev/sda2   /mnt/excess ntfs-3g    permissions,locale=en_US.utf8    0   2

You can then

sudo chown your_user:your_user /mnt/excess

Easier then uid,dmask,fmask.

share|improve this answer
    
great answer - thanks! +1 –  nicorellius Jan 15 at 22:04
add comment

Might not be a good solution , but you can always map user id to your own one , or the group id:

Just an example here , my user id was 1000

/dev/sda5 /mnt/excess ntfs defaults,uid=1000,rw 0 0

In that case , all files mounted owned by user ided 1000

share|improve this answer
    
That works, but with or with out the "rw" option, it still mounts with permissions drwxrwxrwx –  Amanda Mar 17 '12 at 14:10
add comment

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.