2

Environment

  • Ubuntu 14.04 LTS Desktop 64-bit

Problem

  • only members of group_name should be allowed to mount,unmount and read,write,execute drive_name

Potential Solution

  1. edit /etc/fstab add line: /dev/abc /media/drive_name ext4 group 0 2
  2. create group: sudo groupadd group_name
  3. add users to group: sudo adduser user1 group_name
  4. mount point owned by group: sudo chgrp /media/drive_name group_name

Question

  1. Is this the correct, secure way of solving the problem?

Thank you :)

4
  • did you tried it?
    – Braiam
    Aug 8 '14 at 20:04
  • better way you can create a sudo user instead of this. if so you can define only which service the particular sudo user can do. Aug 9 '14 at 4:05
  • I think using automount will do most of what you want. Set it to mount /dev/abc on /media/group_name_private/drive_name, where /media/group_name_private is user root, group group_name, and mode 750. automount doesn't offer a way to immediately unmount, though; you just have to have everyone stop using the filesystem for a minute or two (configurable) and automount will then unmount it. Aug 15 '14 at 0:40
  • You got the arguments in the wrong order on line 4: it should be "chgrp group_name path", not "chgrp path group_name". Sep 10 '14 at 18:32
1

Unfortunately not. From man mount:

the user must be member of the group of the special file.

Note that it says special file and not mount point. If you run ls -l against your partitions you'll note that the group owner is disk.

Therefore, make user1 a member of the disk group and he/she will be able to mount the partition as long as the group option is in the partition's /etc/fstab line.

Similarly, make user a member of the cdrom group and he/she will be able to mount the cdrom after you ensure that group is in the cdrom's /etc/fstab entry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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