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 am trying to let other users access my external 1TB NTFS hard drive mounted automatically at /media/[username]/STORAGE

The problem is that by default, udisk2 (present with Ubuntu 12.10) automatically creates:

  • /media/[username] with chown: root:root and chmod: 700
  • /media/[username]/STORAGE with chown: [username]:[username] and chmod: 700

Therefore no other user can access it, not even the UPnP server if it is running as a different user than [username].

Of course I could, just chmod everything this time but if I umount and mount then the default permissions will be back on and I'll have the same issue.

The answer probably has to do with a permissions to add in /etc/udev/rules.d/ but I am not an expert.

Can you help?

share|improve this question
1  
If you have upgraded to Ubuntu 13.04, there is a solution using /etc/udev/rules.d/ which allows you to restore the former behaviour (mounting the file system as shared in "/media"). See this answer from rocko for details : askubuntu.com/a/276670/28216 –  Golboth Aug 24 '13 at 9:37
add comment

1 Answer 1

You need to add an entry in fstab to tell it where to mount, and also tell it what permissions it should have. Currently you're letting it automount which is limiting other user's ability to access it.

As near as I can judge, you should add an entry to /etc/fstab which looks like:

LABEL=STORAGE /media/username/STORAGE ntfs-3g  dmask=111 fmask=111  0   0 

Which should give everyone all access to the files and directories except for execute. If you want others to be able to read but not write you would use a dmask/fmask of 113. The mask is the exact opposite of the permissions that you want to allow (that's why it's called a mask). Each number is the octal representation of the binary permissions:

000 = 000 000 000
111 = 001 001 001
777 = 111 111 111

and these bits read

rwx(owner) rwx(group) rwx(world)

Normal permissions to allow anyone to do anything at all are 777 (dangerous!) however if you give 777 as the dmask, it makes the actual permissions 000.

Note that LABEL=STORAGE relies on the drive having the label "STORAGE" that fstab can use as a hook. This way, any device that you plug in with the label "STORAGE" will be mounted this way.

share|improve this answer
    
Thanks for the detailed answer, but I am not sure this is the right way. The problem is that the disk is removable, so I am afraid that if I add an entry in /etc/fstab it could lead to errors if the disk is not plugged in. Can we do something similar in /etc/udev/rules.d? –  jtheoof Dec 9 '12 at 14:31
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.