# mount device as user



## gulanito (Jul 25, 2009)

Hello. 
My quiestion is prety basic, but i dont have a solution in google or handbook.

I created a new dir named /pen and I edited the fstab to add a pendrive: 
(/dev/da0  /pen msdosfs rw 0 0)

I can mount that as a root and I can read and write it.

The questions are:

1)How should I do to mount/unmount devices as a normal user (but not use the command sudo, I need to do "mount /pen" as a normal user, not "sudo mount /pen)

2)How should I do to write in the pendrive as a normal user (I try to write to it when the pendrive is mounted as "sudo mount /pen" but I cant write)

Thanks!


----------



## ale (Jul 25, 2009)

Try setting the vfs.usermount sysctl to 1 and mount the device on a directory you own.


----------



## graudeejs (Jul 25, 2009)

add to your /etc/sysctl.conf

```
vfs.usermount=1
```

and add something like this to your /etc/devfs.rules

```
[localrules=10]
add path 'da*' mode 0660 group users
add path 'md*' mode 0660 group users
```

and add 


```
devfs_system_ruleset="localrules"
```
to /etc/rc.conf


In example above users in group users will be able to mount flash and virtual disks on directories they own (~/mnt for example)


also modify your /etc/devfs.conf

```
own     acd0    root:users
perm    acd0    0660
```
this will allow users in group users to mount /dev/acd0 which usually is cd/dvd-rom


----------



## SirDice (Jul 27, 2009)

If you use GNOME, XFCE or KDE have a look here:
http://www.freebsd.org//gnome/docs/halfaq.html

That will show how to use HAL to automount removable devices.


----------

