# [SOLVED] Probelm with mount with udev regulars and rights

## lovelytux

Hey,

Problem: mount shows me, that the filesystem is mounted for user but only root has rights not the normal user.

I mount an usb-stick. The Filesystem is ext3. I write regular for udev: /etc/udev/rules.d/33-usb.rules

```
KERNEL=="sdc2", ATTR{size}=="23592960", SYMLINK+="usb-sdc2-stick",

MODE="0666", GROUP="users"

ACTION=="add", RUN+="/bin/mount -t auto -o rw,user,users /dev/usb-sdc2-stick

/media/usb-sdc2"

ACTION=="remove", RUN+="/bin/umount /media/usb-sdc2"
```

The Symling "/dev/usb-sdc2-stick" is create:

/dev/ls -hasl usb-sdc2* => 

```
0 lrwxrwxrwx  1 root root     4 23. Aug 19:19 usb-sdc2-stick -> sdc2
```

mount -l | grep sdc2 =>

```
/dev/sdc2 on /media/usb-sdc2 type ext3 (rw,noexec,nosuid,nodev,user))
```

 shows me, that the device is mounted with "rw" but the user can't create folders or files.

Thanks for help!

lovelytuxLast edited by lovelytux on Sat Aug 24, 2013 9:03 am; edited 2 times in total

----------

## quilosaq

What output 

```
ls -ld /media/usb-sdc2
```

?

----------

## lovelytux

Hey,

```
drwxr-xr-x 3 root root 4096 23. Aug 18:36 /media/usb-sdc2
```

lovelytux

----------

## quilosaq

Try passing an additional option for mount. Udev rule looks like:

```
ACTION=="add", RUN+="/bin/mount -t auto -o rw,user,users,umask=0 /dev/usb-sdc2-stick

/media/usb-sdc2"
```

----------

## lovelytux

Hey,

nothing is mount.  *Quote:*   

> mount -l | grep /dev/sdc2

  is empty. 

lovelytux

----------

## lovelytux

Hey,

I delete "user,users"(contradictory)  and add one line (3rd). I hope this is a neat solution ! ?

```
KERNEL=="sdc2", ATTR{size}=="23592960", SYMLINK+="usb-sdc2-stick", MODE="0666", GROUP="users"

ACTION=="add", RUN+="/bin/mount -t auto -o rw  /dev/usb-sdc2-stick /media/usb-sdc2"

ACTIOM=="add", RUN+="/bin/chown -R lovelytux: /media/usb-sdc2"

ACTION=="remove", RUN+="/bin/umount /media/usb-sdc2"
```

Thanks for help! lovelytux

----------

## quilosaq

I was wrong. umask is for fat filesystem only. Sorry.

----------

## PaulBredbury

 *Quote:*   

> ACTION=="remove", RUN+="/bin/umount

 

That will not work as hoped, because umount must be performed before removal. Remove that useless rule.

It's sensible to use the flush option, to be confident that writes have been performed, e.g.:

```
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},flush,utf8,gid=100,umask=002"
```

----------

