# Can I mount vfat partition using non root ?



## sw2wolf (Jun 19, 2010)

In linux, i using the following options to mount a VFAT partition.

```
%cat /etc/fstab|grep vfat
/dev/sda7	/media/F	vfat	 rw,defaults,utf8,uid=1000,gid=1000,dmask=022,fmask=133		0	0
```

It seems i can not use the same options in FreeBSD.

Sincerely!


----------



## wblock@ (Jun 19, 2010)

It's not called vfat in FreeBSD, see msdosfs(5).


----------



## sw2wolf (Jun 19, 2010)

Yes, you are right.

```
>cat /etc/fstab|grep -i msdos
/dev/ad4s7		/media/F	msdosfs	rw		0	0

>ls -l /media/F
-rwxr-xr-x  1 root  wheel   44738560  1 20 11:21 8.0-RELEASE-i386-bootonly.iso*
drwxr-xr-x  1 root  wheel      16384  3 31  2008 Recycled/
drwxr-xr-x  1 root  wheel      16384  6 15  2008 System Volume Information/
-rwxr-xr-x  1 root  wheel  229402624  6 27  2008 WinXp.iso*
```

In freebsd /media/F belongs to root.


----------



## aragon (Jun 19, 2010)

In /etc/sysctl.conf


```
vfs.usermount=1
```

In /etc/devfs.rules:


```
[localrules=10]
 add path ad* mode 0660 group operator
```

In /etc/rc.conf:


```
devfs_system_ruleset="localrules"
```

Then run:


```
chown uid:gid /media/F
/etc/rc.d/sysctl restart
/etc/rc.d/devfs restart
```

Make sure your user account is a member of the "operator" group.


----------



## SirDice (Jun 19, 2010)

Only vfs.usermount is needed. And the user must own the mountpoint. No need to change devfs rules.


----------



## aragon (Jun 19, 2010)

SirDice said:
			
		

> No need to change devfs rules.


Strange.  Over here my disk dev entries default to 640 so custom devfs rules are definitely needed for user mount.


----------



## sw2wolf (Jun 20, 2010)

It works without changing devfs rules.


```
>sysctl -a | grep -i usermount
vfs.usermount: 1

>ls -ld /media/F
drwxr-xr-x  1 sw2wolf  wheel  16384 12 31  1979 /media/F/

>cat /etc/fstab |grep -i msdos
/dev/ad4s7		/media/F	msdosfs	rw		0	0

>sudo mount -a
>>ls -l /media/F
-rwxr-xr-x  1 sw2wolf  wheel   44738560  1 20 11:21 8.0-RELEASE-i386-bootonly.iso*
drwxr-xr-x  1 sw2wolf  wheel      16384  3 31  2008 Recycled/
drwxr-xr-x  1 sw2wolf  wheel      16384  6 15  2008 System Volume Information/
-rwxr-xr-x  1 sw2wolf  wheel  229402624  6 27  2008 WinXp.iso*
......
```

thanks!


----------



## aragon (Jun 20, 2010)

sw2wolf said:
			
		

> ```
> >sudo mount -a
> ```


In that case you won't need vfs.usermount enabled...


----------

