View previous topic :: View next topic |
Author |
Message |
m4rv1n n00b
Joined: 26 Oct 2013 Posts: 4
|
Posted: Sat Oct 26, 2013 2:56 pm Post subject: uam.conf MP_PERMS |
|
|
I use uam to auto mount my usb devices. It works quite well but I stuck with the configuration of the MP_PERMS value.
The aformentioned value is located in /etc/udev/uam.conf
Code: |
# NOTE:
# This is just a sourced bash script, so think what you put here.
# If you'd like to use $ sign, you must enclose string in '' or escape it.
# If you'd like to use some other variable, feel free to use it.
# In booleans 1, 'y', 't', 'yes', 'true' and 'on' evaluate as true.
# Whether to log progress verbosely, or just print a plain summary at the end.
VERBOSE=0
# A trace file path if tracing should be enabled. Leave empty otherwise.
# (it might be a good idea to place this file in /run, to have R/W ASAP)
TRACE=
# Base path for all uam-created mountpoints.
MOUNTPOINT_BASE='/media'
# Permissions to set on created parent directories and mountpoints.
PARENT_PERMS=0755
MP_PERMS=0700
# GID and umask of mounted filesystems like VFAT or NTFS.
# Is used directly in MOUNT_OPTS configvar.
MOUNT_GROUP='plugdev'
MOUNT_UMASK=07
MOUNT_FMASK=0117 # -x
# Options to pass to mount (default -- will be used if no specific defined).
MOUNT_OPTS='noatime'
# Options to pass to mount with a specific filesystem. For known ids, see udev's
# ${ID_FS_TYPE}. The suffixes MUST be uppercase (unless you have bash with
# case-insensitive variable names).
MOUNT_OPTS_VFAT="umask=${MOUNT_UMASK},fmask=${MOUNT_FMASK},gid=${MOUNT_GROUP},${MOUNT_OPTS}"
MOUNT_OPTS_NTFS="${MOUNT_OPTS_VFAT}"
# You may also use MOUNT_OPTS_* to use a different fs type than one detected
# by mount, e.g.:
MOUNT_OPTS_NTFS_3G="${MOUNT_OPTS_VFAT} -t ntfs-3g"
# MOUNT_OPTS_NTFS_3G="${MOUNT_OPTS_VFAT},force -t ntfs-3g"
# Whether to try to remount fs R/O if umount fails.
UMOUNT_TRY_RO=1
# Whether to engage an lazy-umount if umount fails.
UMOUNT_TRY_LAZY=1
# Whether to remove created mountpoints after umount or mount failure.
REMOVE_MOUNTPOINTS=1
# Whether to search for and remove unused mountpoints when we receive umount
# request for non-mounted (already unmounted?) device.
CLEANUP_ALLOW=1
# How deep to search for unused mountpoints under ${MOUNTPOINT_BASE}.
# 0 means to look only directly under ${MOUNTPOINT_BASE}, 1 to look in its'
# subdirectories etc. If not set, we try to count slashes in
# ${MOUNTPOINT_TEMPLATES}.
# CLEANUP_MAXDEPTH=0
# Whether we should stay on the same filesystem when searching for unused
# mounpoints (to avoid reading through floppies, CDs etc.). If you use
# mountpoints on a different filesystem than ${MOUNTPOINT_BASE} and you want to
# cleanup them too, set this to false.
CLEANUP_XDEV=1
# Whether to search for and remove symlinks to removed mountpoints.
CLEANUP_SYMLINKS=1
# 'Array' of possible mountpoint name templates to use (uam will use first free).
# Can contain pathnames relative to ${MOUNTPOINT_BASE}. If you'd like to use
# absolute pathnames here, just set MOUNTPOINT_BASE=''.
#
# You can use any environment variable provided by udev, including:
# ${ID_FS_TYPE} for fs type (ext2, swap, vfat, etc.)
# ${ID_FS_UUID_ENC} for fs UUID (unique identifier)
# ${ID_FS_LABEL_ENC} for fs label (user-specified)
# Below will work only under real udev, not when launched manually:
# ${ID_SERIAL} for full serial of device (incl. vendor, model and inst)
# ${ID_SERIAL_SHORT} for actual serial of device
# You can also use the following additional uam-specific vars:
# ${DEVBASENAME} to get basename of the device (i.e. sda1)
# ${PARTN} partition number (i.e. 1)
# ${SERIAL} like ${ID_SERIAL}, but without the instance
# If you would like to lookup these for a specific device, please call:
# /sbin/blkid -o udev /dev/sdXY
# or (with older udev):
# /lib/udev/vol_id /dev/sdXY
#
# If your /bin/sh points to bash you might also use standard bash array below.
# Simply change the single quotes below to parentheses and everything should
# work fine. Please notice that due to the nature of processing array variables,
# real bash arrays need to be 'directly' interpolated by bash while
# pseudo-arrays have to be quoted to prevent variable interpolation.
MOUNTPOINT_TEMPLATES='
"${ID_FS_LABEL_ENC}" # label
"${ID_FS_LABEL_ENC:+${SERIAL}-${ID_FS_LABEL_ENC}}" # serial-label (if -n label)
"${SERIAL:+${SERIAL}-${PARTN}}" # serial-partition number
"${DEVBASENAME}" # sdXY
'
# Templates used for mountpoint symlink creation, i.e. to get nice names. Can
# overlap with MOUNTPOINT_TEMPLATES - when overlapping mountpoint is used the
# symlink will be skipped.
#SYMLINK_TEMPLATES='
# "by-id/${SERIAL}"
#'
# Enable or disable supplied default hooks.
# Wait for /media to become writable before starting to mount. This is required
# in order to mount correctly media already inserted on boot.
HOOK_WAIT_FOR_MEDIA=1
# Notice user about (u)mounts using libnotify. This requires the sw-notify-send
# hack: x11-misc/sw-notify-send or http://github.com/mgorny/tinynotify-send/
HOOK_SW_NOTIFY=1
# Store additional (${MOUNT_GROUP}-readable) cache for uam-pmount helper.
# Disabled when unset.
HOOK_PMOUNT_CACHE=
#HOOK_PMOUNT_CACHE=/run/uam.cache
# Filter out devices you don't want uam to handle. The function below should
# return true value when a particular device should not be mounted and false
# otherwise (which is equal to not declaring the func at all).
#
# The following example disables mounting partitions with one of the predefined
# UUIDs (these are VFAT-style UUIDs). Please notice that it is either necessary
# to use boolean operators or '&& return 0' to keep returned value clean.
#
# filter_devices() {
# [ "${ID_FS_UUID}" = "1234-5678" ] || \
# [ "${ID_FS_UUID}" = "ABCD-ABCD" ]
# }
# vim:syntax=sh
|
My intesion was to set MP_PERMS=0770 so that all members of the group 'plugdev' have full access to the mount point. But unfortunately I alway end up with the permissions 'drwxr-xr-x' no matter to which value MP_PERMS is set:
Code: |
drwxr-xr-x 3 root root 4096 Oct 24 00:01 SAM-1
drwxr-xr-x 3 root root 4096 Oct 24 00:02 SAM-2 |
I also had a look to the uam-common.sh under /lib/udev/uam or https://bitbucket.org/mgorny/uam/src/83f96a87ab21296672813ae45ee7841db381f29f/src/uam-common.sh?at=master but I didn't found out why it should not work. Especially the mp_create() function do excatly what I would suppose.
Code: | # mp_create( <mountpoint-path> )
# Create the mountpoint if it doesn't exist yet.
mp_create() {
local mp notefile
mp=${1}
notefile=${mp}/${MP_NOTEFN}
# we need to call it instead of using 'mkdir -p' below
# because we want parents to have another permissions
mkdir_parents "${mp}"
if [ ! -d "${MP}" ]; then
debug "... trying to create ${mp}"
mkdir -m "${MP_PERMS}" "${mp}"
date -u "+%D %T ${$}" > "${notefile}"
fi
} |
Do you have a clue what the issue could be? |
|
Back to top |
|
|
eyoung100 Veteran
Joined: 23 Jan 2004 Posts: 1428
|
Posted: Mon Oct 28, 2013 10:17 pm Post subject: |
|
|
Code: | MP_PERMS
0 - Use set setuid, setgid, or sticky bit
7 - Full permission for owner (rwx = 4+2+1=7)
0 - Remove group permission (--- = 0+0+0=0)
0 - Remove world permission (--- = 0+0+0=0) |
MP_PERMS inherits from Code: | PARENT_PERMS
0 - Use set setuid, setgid, or sticky bit
7 - Full permission for owner (rwx = 4+2+1=7)
5 - Read/Execute for Group (rx = 4+0+1=5)
5 - Read/Execute for Others (rx = 4+0+1=5) |
Code: | drwxr-xr-x 3 root root 4096 Oct 24 00:01 SAM-1
drwxr-xr-x 3 root root 4096 Oct 24 00:02 SAM-2 | = 0755 _________________ The Birth and Growth of Science is the Death and Atrophy of Art -- Unknown
Registerd Linux User #363735
Adopt a Post | Strip Comments| Emerge Wrapper |
|
Back to top |
|
|
m4rv1n n00b
Joined: 26 Oct 2013 Posts: 4
|
Posted: Thu Oct 31, 2013 4:39 pm Post subject: |
|
|
Thanks!
Based on your info I could set MP_PERMS and PARENT_PERMS to
Code: | PARENT_PERMS=0775
MP_PERMS=0700 |
or
Code: | PARENT_PERMS=0775
MP_PERMS=0775 |
But for both I still end up with
Code: | drwxr-xr-x 3 root root 4096 Oct 24 00:01 SAM-1
drwxr-xr-x 3 root root 4096 Oct 24 00:02 SAM-2 |
Which looks quite strange to me. It is probably worth to mention that both SAM-1 and SAM-2 are ext3 formated.
Do I have to consider some other features? |
|
Back to top |
|
|
eyoung100 Veteran
Joined: 23 Jan 2004 Posts: 1428
|
Posted: Thu Oct 31, 2013 4:48 pm Post subject: |
|
|
Did the mount directories exist before you installed uam
Code: | # Permissions to set on created parent directories and mountpoints. |
Created Parents mean the new permissions only happen if the directories didn't exist _________________ The Birth and Growth of Science is the Death and Atrophy of Art -- Unknown
Registerd Linux User #363735
Adopt a Post | Strip Comments| Emerge Wrapper |
|
Back to top |
|
|
m4rv1n n00b
Joined: 26 Oct 2013 Posts: 4
|
Posted: Thu Oct 31, 2013 6:16 pm Post subject: |
|
|
No, except the /media directory.
All the other directories going to be created by uam and get removed via uam-pumount. |
|
Back to top |
|
|
eyoung100 Veteran
Joined: 23 Jan 2004 Posts: 1428
|
Posted: Thu Oct 31, 2013 6:50 pm Post subject: |
|
|
That answers that:
If the parent directory /media was created before uam, UAM cannot monitor or set permisions as it did not create the directory _________________ The Birth and Growth of Science is the Death and Atrophy of Art -- Unknown
Registerd Linux User #363735
Adopt a Post | Strip Comments| Emerge Wrapper |
|
Back to top |
|
|
m4rv1n n00b
Joined: 26 Oct 2013 Posts: 4
|
Posted: Sat Nov 09, 2013 2:47 pm Post subject: |
|
|
Ok, thanks for the info. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|