Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
I don't understand the question. How could testuser “cp to [the USB stick]” but not “access the mounted USB stick”? –  Gilles Aug 10 '13 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? –  Gilles Aug 11 '13 at 11:14

2 Answers 2

up vote 2 down vote accepted

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
share|improve this answer
    
Unfortunately I don't know anything about automounting, so I cannot help you there. –  user49740 Aug 24 '13 at 15:26

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.

share|improve this answer

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.