5

Is there a command (on Debian Wheezy) that a testuser that belongs only to the group testuser can run (maybe he needs to be listed in sudoers first) in order to mount a USB stick as if he belonged to the group plugdev or floppy?. So he can't access the mounted USB stick directly (since he is not in plugdev/floppy) but could cp to it (if he is in sudoers and can run cp as a floppy group member).

Maybe there is a way to realize it using regular mount and sudoers? Can a user mount a device as another user (member of another group) without having access to the device?

2
  • I don't understand the question. How could testuser “cp to [the USB stick]” but not “access the mounted USB stick”? Commented Aug 10, 2013 at 22:56
  • We're making progress but this is still not clear. Can testuser pick the file names on the USB stick? Can he create directories? Can he overwrite existing files? Can he copy what he wants or only from a certain source directory that he may not be able to write to? Commented Aug 11, 2013 at 11:14

2 Answers 2

3

Add this line to your /etc/fstab:

/dev/sdb1 /mnt/location vfat users,uid=0,gid=$GID,umask=0047 0 0

where $GID is testuser's group id.

  • Everyone can mount the stick
  • root can do everything he wants
  • testuser can write to the stick but not read from it
  • everyone else cannot write nor read from the stick
1
  • Unfortunately I don't know anything about automounting, so I cannot help you there.
    – user49740
    Commented Aug 24, 2013 at 15:26
2

I think that you need to add a line like this to your /etc/fstab:

/dev/sdb1 /mnt/usbstick vfat user,noauto,noatime,flush 0 0

This should allow non-root users to mount the USB stick /dev/sdb1 on /mnt/usbstick. Even better would be to replace the path to the USB stick /dev/sdb1 by its UUID, like in UUID=7a5e30c3-752a-4ee2-93be-7ad08af7cee7.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .