More information:

As a work around I have added a "sg plugdev 'pmount'"
to the udev rules. Now I have a plugdev group on the mounts but the mounts
with iso9660 file system:

<99-ZZZ-local-udev-automount.rules>
KERNEL!="sd[b-z]*", KERNEL!="sr*", GOTO="exit"

# Do not mount devices already mounted somewhere else to avoid entries for
all your local partitions in /media
ACTION=="add", PROGRAM=="/bin/grep -q ' /dev/%k ' /proc/self/mountinfo",
GOTO="exit"

# Import FS infos
SUBSYSTEMS=="usb", IMPORT{program}="/sbin/blkid -o udev -p %N"
SUBSYSTEMS=="scsi", IMPORT{program}="/sbin/blkid -o udev -p %N"

PROGRAM=="/sbin/blkid -o value -s LABEL %N", ENV{dir_name}="%c"
# use basename to correctly handle labels such as ../mnt/foo
PROGRAM=="/usr/bin/basename '%E{dir_name}'", ENV{dir_name}="%c"

# Get a label if present, otherwise specify one
SUBSYSTEMS=="usb", ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
SUBSYSTEMS=="usb", ENV{ID_FS_LABEL}=="", ENV{dir_name}="usb-%k"
SUBSYSTEMS=="scsi", ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
SUBSYSTEMS=="scsi", ENV{ID_FS_LABEL}=="", ENV{dir_name}="usb-%k"

# Global mount options
#SUBSYSTEMS=="usb", ATTRS{removable}=="1", GROUP="plugdev", MODE="0770"
# esto es solo para el /dev/sdxx el /media/mount_point no vale
#SUBSYSTEMS=="usb", GROUP="media", MODE="0770"
SUBSYSTEMS=="usb", ACTION=="add", ENV{pmount_options}="--noatime --umask
007"
SUBSYSTEMS=="scsi", ACTION=="add", ENV{pmount_options}="--noatime --umask
007"
#SUBSYSTEMS=="usb", ACTION=="add", ENV{pmount_options}="--noatime --umask
000"
#SUBSYSTEMS=="usb", ACTION=="add", ENV{pmount_options}="--atime --umask 007"

# File system specific mount options to avoid auto probing
# SUBSYSTEMS=="usb", ACTION=="add", ENV{ID_FS_TYPE}=="ntfs|vfat",
ENV{pmount_options}="%E{pmount_options} --charset utf8"
# SUBSYSTEMS=="usb", ACTION=="add", ENV{ID_FS_TYPE}=="ntfs",
ENV{pmount_options}="%E{pmount_options} -t ntfs-3g"
# SUBSYSTEMS=="usb", ACTION=="add", ENV{ID_FS_TYPE}=="vfat",
ENV{pmount_options}="%E{pmount_options} -t vfat"
# SUBSYSTEMS=="usb", ACTION=="add", ENV{ID_FS_TYPE}=="ext2",
ENV{pmount_options}="%E{pmount_options} -t ext2"
# SUBSYSTEMS=="usb", ACTION=="add", ENV{ID_FS_TYPE}=="ext3",
ENV{pmount_options}="%E{pmount_options} -t ext3"
# SUBSYSTEMS=="usb", ACTION=="add", ENV{ID_FS_TYPE}=="ext4",
ENV{pmount_options}="%E{pmount_options} -t ext4"

# Mount the device
#SUBSYSTEMS=="usb", ACTION=="add", RUN+="/usr/bin/pmount
$env{pmount_options} /dev/%k /media/%E{dir_name}"
#SUBSYSTEMS=="usb", ACTION=="add", RUN+="/usr/bin/pmount
$env{pmount_options} %N %E{dir_name}"
#SUBSYSTEMS=="usb", ACTION=="add", RUN+="/bin/sh -c '/usr/bin/pmount
$env{pmount_options} %N %E{dir_name}; /bin/mount -o remount,gid=46
/media/%E{dir_name} '"
#SUBSYSTEMS=="usb", ACTION=="add", RUN+="/bin/sh -c '/usr/bin/pmount
$env{pmount_options} %N %E{dir_name}; /bin/chgrp -R plugdev
/media/%E{dir_name}'"
SUBSYSTEMS=="usb", ACTION=="add", RUN+="/usr/bin/sg plugdev
'/usr/bin/pmount $env{pmount_options} %N %E{dir_name}'"
SUBSYSTEMS=="scsi", ACTION=="add", RUN+="/usr/bin/sg plugdev
'/usr/bin/pmount $env{pmount_options} %N %E{dir_name}'"
#SUBSYSTEMS=="usb", ACTION=="add", RUN+="/bin/mount -o remount,gid=117
/media/%E{dir_name}"

# Clean up after removal
SUBSYSTEMS=="usb", ACTION=="remove", ENV{dir_name}!="",
RUN+="/usr/bin/pumount /dev/%k"
SUBSYSTEMS=="scsi", ACTION=="remove", ENV{dir_name}!="",
RUN+="/usr/bin/pumount /dev/%k"

# Exit
LABEL="exit"

</99-ZZZ-local-udev-automount.rules>

************

$ls -al /media/
total 1
drwxrws---  2 root plugdev   40 Jun  6 22:25 .
drwxr-xr-x 24 root root    1024 Mar 12 21:33 ..
<dev plugged>
$ ls -al /media/
total 3
drwxrws---  4 root plugdev   80 Jun  6 22:25 .
drwxr-xr-x 24 root root    1024 Mar 12 21:33 ..
dr-xr-xr-x  1 root plugdev 2048 Nov 17  2008 20081117_084322
drwxr-sr-x  2 root plugdev   60 Jun  6 22:25 usb-sdb
$ mount | grep media
tmpfs on /media type tmpfs
(rw,nosuid,nodev,noexec,relatime,mode=2770,gid=46)
/dev/sr0 on /media/20081117_084322 type iso9660
(ro,nosuid,nodev,noexec,noatime,uid=0,gid=46)
/dev/sdb on /media/usb-sdb type vfat
(rw,nosuid,nodev,noexec,noatime,gid=46,fmask=0117,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,quiet,errors=remount-ro)




************



---------- Forwarded message ----------
From: <jmbou...@gmail.com>
Date: 2012/5/31
Subject: Bug#675406: pmount: pmount ignores umask with iso9660 filesystem
To: Debian Bug Tracking System <sub...@bugs.debian.org>


Package: pmount
Version: 0.9.23-2
Severity: normal

Dear Maintainer,
*** Please consider answering these questions, where appropriate ***

  * What led up to the situation?

$ pmount --umask=007 sdb1

$ mount | grep sdb1
/dev/sdb1 on /media/sdb1 type iso9660
(ro,nosuid,nodev,noexec,relatime,uid=1000,gid=1000,iocharset=utf8)

  * What exactly did you do (or not do) that was effective (or
    ineffective)?

$ls -al /dev/sdb1
brw-rw---T 1 root floppy 8, 17 May 31 23:12 /dev/sdb1
$pmount --umask=007 sdb1
mount: warning: /media/sdb1 seems to be mounted read-only.

  * What was the outcome of this action?
$ ls -al /media/
total 5
drwxrws---  3 root plugdev   60 May 31 23:13 .
drwxr-xr-x 24 root root    1024 Mar 12 21:33 ..
dr-xr-xr-x  1 user user     4096 Feb  2 22:41 sdb1

  * What outcome did you expect instead?

$ ls -al /media/
total 5
drwxrws---  3 root plugdev   60 May 31 23:13 .
drwxr-xr-x 24 root root    1024 Mar 12 21:33 ..
drwxrwx---  1 user user     4096 Feb  2 22:41 sdb1

ext2 filesystem does not have this problem:

$ ls -al /dev/sdb1
brw-rw---T 1 root floppy 8, 17 May 31 23:17 /dev/sdb1
$ pmount --umask=007  sdb1
$ mount | grep sdb1
/dev/sdb1 on /media/sdb1 type ext2
(rw,nosuid,nodev,noexec,relatime,errors=remount-ro,user_xattr,acl)
$ ls -al /media/
total 2
drwxrws---  3 root plugdev   60 May 31 23:19 .
drwxr-xr-x 24 root root    1024 Mar 12 21:33 ..
drwxrwx---  7 root plugdev 1024 May 31 00:04 sdb1


As a side note, pmount does not respect group sticky bit.


I discovered this behaviour when trying udev rules:
The below rule works fine with non-iso9660 filesystems
and lets user pumount, when the filesystem is iso9660
does not let the user pumount.

<99-ZZZ-local-udev-automount.rules>
# -*- Mode: conf -*-
KERNEL!="sd*[1-9]*", GOTO="exit"

# Do not mount devices already mounted somewhere else to avoid entries for
all your local partitions in /media
ACTION=="add", PROGRAM=="/bin/grep -q ' /dev/%k ' /proc/self/mountinfo",
GOTO="exit"

# Import FS infos
SUBSYSTEMS=="usb", IMPORT{program}="/sbin/blkid -o udev -p %N"

PROGRAM=="/sbin/blkid -o value -s LABEL %N", ENV{dir_name}="%c"
# use basename to correctly handle labels such as ../mnt/foo
PROGRAM=="/usr/bin/basename '%E{dir_name}'", ENV{dir_name}="%c"

# Get a label if present, otherwise specify one
SUBSYSTEMS=="usb", ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
SUBSYSTEMS=="usb", ENV{ID_FS_LABEL}=="", ENV{dir_name}="usb-%k"

# Global mount options
#SUBSYSTEMS=="usb", ATTRS{removable}=="1", GROUP="plugdev", MODE="0770"
# esto es solo para el /dev/sdxx el /media/mount_point no vale
#SUBSYSTEMS=="usb", GROUP="media", MODE="0770"
SUBSYSTEMS=="usb", ACTION=="add", ENV{pmount_options}="--noatime --umask
007"
#SUBSYSTEMS=="usb", ACTION=="add", ENV{pmount_options}="--noatime --umask
000"
#SUBSYSTEMS=="usb", ACTION=="add", ENV{pmount_options}="--atime --umask 007"

# File system specific mount options to avoid auto probing
# SUBSYSTEMS=="usb", ACTION=="add", ENV{ID_FS_TYPE}=="ntfs|vfat",
ENV{pmount_options}="%E{pmount_options} --charset utf8"
# SUBSYSTEMS=="usb", ACTION=="add", ENV{ID_FS_TYPE}=="ntfs",
ENV{pmount_options}="%E{pmount_options} -t ntfs-3g"
# SUBSYSTEMS=="usb", ACTION=="add", ENV{ID_FS_TYPE}=="vfat",
ENV{pmount_options}="%E{pmount_options} -t vfat"
# SUBSYSTEMS=="usb", ACTION=="add", ENV{ID_FS_TYPE}=="ext2",
ENV{pmount_options}="%E{pmount_options} -t ext2"
# SUBSYSTEMS=="usb", ACTION=="add", ENV{ID_FS_TYPE}=="ext3",
ENV{pmount_options}="%E{pmount_options} -t ext3"
# SUBSYSTEMS=="usb", ACTION=="add", ENV{ID_FS_TYPE}=="ext4",
ENV{pmount_options}="%E{pmount_options} -t ext4"

# Mount the device
#SUBSYSTEMS=="usb", ACTION=="add", RUN+="/usr/bin/pmount
$env{pmount_options} /dev/%k /media/%E{dir_name} ; /bin/mount -o
remount,gid=117 /media/%E{dir_name}"
#SUBSYSTEMS=="usb", ACTION=="add", RUN+="/usr/bin/pmount
$env{pmount_options} /dev/%k /media/%E{dir_name}"
SUBSYSTEMS=="usb", ACTION=="add", RUN+="/usr/bin/pmount
$env{pmount_options} %N %E{dir_name}"
#SUBSYSTEMS=="usb", ACTION=="add", RUN+="/bin/mount -o remount,gid=117
/media/%E{dir_name}"

# Clean up after removal
SUBSYSTEMS=="usb", ACTION=="remove", ENV{dir_name}!="",
RUN+="/usr/bin/pumount /dev/%k"

# Exit
LABEL="exit"

</99-ZZZ-local-udev-automount.rules>


Related:

</etc/systemd/system/media.mount>
[Unit]
Description=Media Directory
Before=local-fs.target

[Mount]
What=tmpfs
Where=/media
Type=tmpfs
Options=mode=2770,nosuid,nodev,noexec,gid=46
<//etc/systemd/system/media.mount>
gid 46 is for plugdev group


*** End of the template - remove these lines ***


-- System Information:
Debian Release: wheezy/sid
 APT prefers testing
 APT policy: (990, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored:
LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages pmount depends on:
ii  libblkid1  2.20.1-5
ii  libc6      2.13-32

pmount recommends no packages.

Versions of packages pmount suggests:
ii  cryptsetup  2:1.4.1-3

-- no debconf information

Thank you for your help.






-- 
Gracias por la atención.

Un saludo.

Reply via email to