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.

How do I give permission to a basic user to access read, execute contents of only one partition but not delete or ad files ... I have 3 partitions , and the one I want to give access is dev/sda4 . Every time I try to mount disc it requires authentication.

share|improve this question
add comment

1 Answer

First thing is first, Reading/Writing/Deleting from a filesystem on a partition are managed by a different set of permissions than mounting a filesystem on a partition. So you will need two fixes, at the minimum, to solve your problem.

Relevant to Both Fixes

inside of the file /etc/fstab there may or may not be a line starting with /dev/sda4. Alternatively there may or may not be a line starting with the UUID of that partition. You can find the UUID by running ls -l /dev/disk/by-uuid and looking for the one that points to /dev/sda4.

If there isn't a line, then you'll need to make one. Either way, the general form of the line should be:

UUID=(hex chars) /mntdir        filesystem    options      0       0
#or
/dev/sda4        /mntdir        filesystem    options      0       0

The part of the line you want to focus on is the options section.

Fix #1, Relevant if your filesystem is FAT/NTFS

If your filesystem doesn't play nice with linux permissions, then you can use the umask option to control the type of access to the files. On NTFS-3G, umask=0022 sets the user file permissions to 0755 which is rwxr-xr-x. gid controls what group the default permissions apply to. So for example, you can make a group called ntfsusers and add all users to that group and then set umask=0002 See the Arch Wiki link for more.

#Example NTFS line:
/dev/sda4 /mntdir ntfs gid=users,umask=0002,user,rw,auto 0   0

Fix #2, Mounting the driver as a normal user

The user and nouser options control who can mount the filesytem. When user is present any user can mount the drive. When nouser is present only root can mount the drive. user turns on a few other flags by default, see the link at the bottom of this post.

#Example NTFS line:
/dev/sda4 /mntdir ext3 defaults,user 0   0

Wikipedia on /etc/fstab: http://en.wikipedia.org/wiki/Fstab Tuxfiles on /etc/fstab: http://www.tuxfiles.org/linuxhelp/fstab.html Arch-Wiki on NTFS-3G options: https://wiki.archlinux.org/index.php/NTFS-3G#Allowing_Group.2FUser

share|improve this answer
1  
You gave a lot of precious information, but in my view you forgot the final part of the answer inside the links. Maybe this is nice to incentive some self-exploration? –  H_7 Feb 13 '12 at 5:41
1  
When it comes to permissions, every scenario is unique. In my experience, it is best to indicate the gist of the solution; because the OP may end up rethinking why they need specific permissions before they find the solution. When I first started working with complex permission issues, I ended up changing my mind and redoing it a dozen times or so before I found a good setup. –  Huckle Feb 13 '12 at 5:51
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.