Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a mountpoint /mnt/v1 and a user bak in group bak. I did this:

sudo chown bak:bak /mnt/v1
sudo chmod 775 /mnt/v1

Now I want to mount an external fat32 drive with partition /dev/sdb1 to this directory. I get the message "only root can do that", so I found out I need to change fstab and added this line:

/dev/sdb1       /mnt/v1     vfat        noauto,user           0      2

But still I get the nasty message "only root can do this" when I mount like this:

bak$ mount -t vfat /dev/sdb1 /mnt/v1

But when I mount as root the whole drive get permissions of root which I don't want.

Is there some action necessary so the new fstab entry get's read into the kernel? How can I achieve what I want?

share|improve this question

1 Answer 1

up vote 9 down vote accepted

When you mount your vfat partion you can pass a uid and gid option to set the userid and groupid the filesystem will be owned by. You can also set a file and directory permission mask. If the filesystem will be used by several people consider creating a group and adding yourself as a member.

Your fstab should look something like this.

/dev/sdb1 /mnt/v1 vfat noauto,user,uid=blah,gid=blah 0 2

and your mount command would look like this.

mount -t vfat /dev/sdb1 /mnt/v1 -o uid=blah,gid=blah

You may also want to look at installing the pmount package to make mounting filesystem as a user easy.


Answer to questions in the comments.

1) is the fstab necessary also when I use the mount command?

If you want a user to be able to mount the command without using sudo, then yes.

2) do I have to be root for the mount command you gave me?

You could remove the noauto from the fstab, and the filesystem will be mounted at boot time. Or as a regular user they can mount with a command like mount /mnt/v1.

3) How do the changes in fstab become active?

Since you have used noauto, nothing will happen automatically. The entry just allows a user to be able to mount the fileystem.

share|improve this answer
    
1) is the fstab necessary also when I use the mount command? 2) do I have to be root for the mount command you gave me? 3) How do the changes in fstab become active? Is there some command or reload or is reboot necessary or is it read every time? –  user12096 Jul 21 '09 at 17:17
    
(those are 3 indepenent questions) –  user12096 Jul 21 '09 at 17:18
    
But I am heard of fusermount command. Aren't this created to mount without a root privileges? –  Hi-Angel Oct 12 at 16:14

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.