# Automount Permissions

## Drone1

My problem is this. My USB thumbdrive is detected and automounted fine. The problem however, is the permissions. 

Config:

-Thumbdrive is a 1Gb PNY Attache

-hald (0.5.5.1-r3) , dbus (0.60-r3), hotplug (20040923-r1) all running ...

```

magneto init.d # tail /var/log/everything/current

Feb 15 14:24:35 [kernel] usb 5-7: new high speed USB device using ehci_hcd and address 12

Feb 15 14:24:35 [kernel] scsi9 : SCSI emulation for USB Mass Storage devices

Feb 15 14:24:40 [kernel]   Vendor:           Model: USB Flash Memory  Rev: 1.00

Feb 15 14:24:40 [kernel] SCSI device sdb: 1970176 512-byte hdwr sectors (1009 MB)

Feb 15 14:24:40 [kernel] sdb: Write Protect is off

Feb 15 14:24:40 [kernel] SCSI device sdb: 1970176 512-byte hdwr sectors (1009 MB)

Feb 15 14:24:40 [kernel] sdb: Write Protect is off

Feb 15 14:24:40 [scsi.agent] disk at /devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7:1.0/host9/target9:0:0/9:0:0:0

Feb 15 14:24:41 [automount_dev] PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7:1.0/host9/target9:0:0/9:0:0:0_ID_MODEL=USB_Flash_M

emory_ID_REVISION=1.00_ID_BUS=usb_SUBSYSTEM=block_ID_SERIAL=_USB_Flash_Memory_DEVPATH=/block/sdb_MINOR=16_ACTION=add_PWD=/_UD

EV_LOG=3_MAJOR=8_DEVLINKS=/dev/disk/by-id/usb-_USB_Flash_Memory /dev/disk/by-path/usb-0x0930-0x653d:0:0:0_UDEVD_EVENT=1_DEVNAME=/dev

/sdb_SHLVL=1_PHYSDEVDRIVER=sd_ID_TYPE=disk_ID_VENDOR=_PHYSDEVBUS=scsi_ID_PATH=usb-0x0930-0x653d:0:0

:0_SEQNUM=1763__=/usr/bin/env

Feb 15 14:24:41 [automount_dev] PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7:1.0/host9/target9:0:0/9:0:0:0_ID_MODEL=USB_Flash_Me

mory_ID_REVISION=1.00_ID_FS_LABEL_SAFE=_ID_FS_LABEL=_ID_BUS=usb_SUBSYSTEM=block_ID_SERIAL=_USB_Flash_Memory_ID_FS_UUID=6E44-059

B_DEVPATH=/block/sdb/sdb1_ID_FS_VERSION=FAT16_MINOR=17_ACTION=add_PWD=/_UDEV_LOG=3_ID_FS_TYPE=vfat_MAJOR=8_DEVLINKS=/dev/usbsd

b1 /dev/disk/by-id/usb-_USB_Flash_Memory-part1 /dev/disk/by-path/usb-0x0930-0x653d:0:0:0-part1 /dev/disk/by-uuid/6E44-059B_UDEVD_EVENT=1_DEVN

AME=/dev/sdb1_SHLVL=1_ID_FS_USAGE=filesystem_PHYSDEVDRIVER=sd_ID_TYPE=disk_ID_VENDOR=_PHYSDEVBUS=scsi_ID_PATH=usb-0x0930-0x653d:

0:0:0_SEQNUM=1764__=/usr/bin/env

magneto init.d # mount |grep 'usb'

usbfs on /proc/bus/usb type usbfs (rw,devmode=0664,devgid=85)

/dev/sdb1 on /mnt/usb/sdb1 type vfat (rw,gid=100,umask=0707)

magneto mnt # ls -al |grep 'usb'

drwxrwxr-x   3 root root       4096 Feb 15 14:24 usb

magneto usb # ls -al

d---rwx---  5 root users      16384 Dec 31  1969 sdb1

magneto usb # df |grep 'usb'

/dev/sdb1               984544     50256    934288   6% /mnt/usb/sdb1

```

I have read the gentoo-wiki UDEV, DBUS/HAL howto, to no avail. REGARDLESS of what I put in FSTAB, the permissions REMAIN THE SAME. 

Yes, I restart all services and have rebooted after making any changes to udev/hotplug/dbus/hal configurations. 

My user account is part of:

web-lm wheel webdev  web-ext nmis games tty disk lp wheel audio cdrom video usb portage plugdev

Have tried runnning ivman previously, but seeing as the current setup automounts, I do not see a need for it.

I need to know what, specifically,  is forcing the permissions on it to give it this......

d---rwx---  5 root users      16384 Dec 31  1969 sdb1

Again, if I add or leave out device and mount specific information in FSTAB, like

/dev/sdb1              /mnt/usb                auto    noauto,rw,user           0 0

the automount permissions DO NOT CHANGE.

Either I'm overlooking some simple config file somewhere in the aforementioned services, or they are just hosed and somehow working.

Any thoughts or insights into some permissions specifics is greatly appreciated.

----------

## Karl_R

Hi,

Dont take this the wrong way, it's not "automounting" the usb drive, but instead it is "hotplug"ing it!

I've been through similar pain myself, adding stuff to /etc/fstab didn't help. In fact it made it worse as it caused confusion.

please forgive me if I'm not too specific here, as I'm at work and not at my gentoo box   :Crying or Very sad: 

you should remove any reference to your usb drive from the /etc/fstab and just allow udev and hotplug to go to work.

If it still doesn't work right (and I'm guessing it doesn't just plug and play  :Wink:  due to the fact you are on the forum) you may need to edit the hotplug/udev rule scripts so that your usb drive always maps with the same alias and permissions,

see: https://forums.gentoo.org/viewtopic-t-433198-highlight-hotplug+usb.html for example

but before you do that... are you using gnome? if so emerge gnome-volume-manager, then run it 

type: 

```
gnome-volume-manager
```

  :Wink:   and in the dilogue that pops up specify how removable media is treated

Cheers

Karl

----------

## Drone1

Well, not any progress.  I'm using KDE, so g-v-m doesn't do me any good. 

I used the information from the link you specified and added 'product' and 'vendor' ID's to both hal.rules and 10-local.rules under /etc/udev/rules.d/ , but no success on that front. Nothing changes with regard to mount point or permissions. I pulled the 'vendor' and 'product' ID's from udevinfo on the thumbdrive, as specified in your link.

```

rules.d # cat hal.rules

#BUS="usb", SYSFS{serial}="USB_Flash_Drive_07E300010570510", KERNEL="sd?1", NAME=%k, SYMLINK="usb",

#BUS="usb", SYSFS{serial}="USB_Flash_Drive_07E300010570510",  KERNEL="sd?1", NAME="%k", SYMLINK="usb", GROUP="hal"

#BUS="usb", KERNEL="sd?1", NAME="%k", SYMLINK="usb", GROUP="usb"

BUS="usb", SYSFS{idVendor}="0x0930", SYSFS{idProduct}="0x653d", NAME="%k", SYMLINK="usb%k", GROUP="hal"

rules.d # cat 10-local.rules

BUS="usb", SYSFS{idVendor}="0x0930", SYSFS{idProduct}="0x653d", NAME="%k", SYMLINK="usb%k", GROUP="hal"

```

The USB drive 'hotplugs' fine, and root can access without problem. Its just non-root users, which is of primary use here, do not have access. All permissions are the same as previously posted. 

Between your link, and this one http://gentoo-wiki.com/HOWTO_D-BUS%2C_HAL%2C_KDE_media:/ , and this http://gentoo-wiki.com/UDEV, that should be enough to get this working but apparently not. 

I do not intend to add other apps to run along with what is working as 'hotplug' is doing its job. I'd prefer to solve this permissions issue within the context of whats currently running.

----------

## luker0

Have you tried adding "MODE=0660" or whichever permissions you prefer to the UDEV rules?  I know I had to to do for my serial connected Palm Pilot a while back to get it to work for general users.

----------

## Drone1

Oops. Overlooked that small singularity....

Just added that to both hal.rules and 10-local.rules and restarted udev/dbus/hald/hotplug. 

No change. At this point, considering re-emerging dbus,hal,hotplug .....

----------

## Drone1

Well, after mulling over the weekend about this problem, I decided to wait for my supervisor linux guru to point out where the flaw was. 

Sure enough he did. 

```

magneto block#  mount |grep 'usb'

/dev/sdb1 on /mnt/usb/sdb1 type vfat (rw,gid=100,umask=0707)

```

After giving him the 'mount' properties for the thumbdrive, I think it was on the order of 1:30 seconds that he figured out where the suspect file config was.

```

/etc/dev.d/block/usbdev.dev

```

Specifically, beginning with line 38.

```

#Create mount point and mount the device to it with proper access

mkdir /mnt/usb/$base  (final mount point of sdb1; not a problem line, but associated to the config)

mount -o async,gid=100,umask=0707 /dev/$base /mnt/usb/$base

```

I changed it to this, which is my preferred.

```

mount -o sync,gid=1000,umask=0002 /dev/$base /mnt/usb/$base   (altered)

```

How or why that got changed is beyond me, but I hope this helps clarify any future issues anyone has.

Thanks for the posts and the support of this forum !!!!!!

----------

## Gentree

suggest you stay with async.  sync is slow as shit and can damage your thumb drive, like kill it.

search for details.

thanks for the other info.

 :Cool: 

----------

