* [PATCH 0/1 V3]udev-extraconf:fix rootless X write to usb storage failed @ 2013-04-28 8:14 Hongxu Jia 2013-04-28 8:14 ` [PATCH 1/1] udev-extraconf:fix " Hongxu Jia 0 siblings, 1 reply; 4+ messages in thread From: Hongxu Jia @ 2013-04-28 8:14 UTC (permalink / raw) To: openembedded-core Change from V2: reference other distribution (ubuntu 12.10). The following changes since commit addcfcda84ed6b43b00f569a6060e3b78196ef52: glib-2.0: disable tests for native builds, and respect ptest for LSB (2013-04-23 13:00:43 +0100) are available in the git repository at: git://git.pokylinux.org/poky-contrib hongxu/fix-udev-xuser http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-udev-xuser Hongxu Jia (1): udev-extraconf:fix rootless X write to usb storage failed meta/recipes-core/udev/udev-extraconf/mount.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 1.7.10.4 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] udev-extraconf:fix rootless X write to usb storage failed 2013-04-28 8:14 [PATCH 0/1 V3]udev-extraconf:fix rootless X write to usb storage failed Hongxu Jia @ 2013-04-28 8:14 ` Hongxu Jia 2013-04-29 10:13 ` Burton, Ross 0 siblings, 1 reply; 4+ messages in thread From: Hongxu Jia @ 2013-04-28 8:14 UTC (permalink / raw) To: openembedded-core Rootless X is owned by xuser, the problem is xuser could not have permissions to write to the usb storage when the file system is vfat(fat16/fat32): 1)On my distribution(Ubuntu 12.10), usb storage is auto mounted by gnome rather than udev, udev detects the plugin event and notify gnome to mount the device, the UID and GID of usb storage is inherited from the gnome's. Login with username `jiahongxu', it has permissions to write usb storage: ...ubuntu log....... $ mount /dev/sdb1 on /media/jiahongxu/fat type vfat (uid=1000,gid=1000,dmask=0077) $ ls /media/jiahongxu/ -al drwx------ 2 jiahongxu jiahongxu 16384 Jan 1 1970 fat .................... Login with username `tester', it has permissions to write usb storage: ...ubuntu log....... $ mount /dev/sdb1 on /media/tester/fat type vfat (uid=1001,gid=1002,dmask=0077) $ ls /media/root/ -al drwx------ 2 tester tester 16384 Jan 1 1970 fat .................... 2)Plug in the previous usb storage to yocto atom which rootless X is enable, xuser doesn't have permissions to write usb storage, the UID and GID of usb storage is inherited from udev's (root): ...yocto atom log... $mount /dev/sdb2 on /media/sdb2 type vfat $ls /media/ -al drwxr-xr-x 2 root root 16384 Jan 1 1970 sdb2 .................... 3)In this situation to reference ubuntu, if rootless X is enable, grant xuser's UID and GID to usb storage while auto mounting by udev. [YOCTO #4004] Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> --- meta/recipes-core/udev/udev-extraconf/mount.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh index 97af608..1135472 100644 --- a/meta/recipes-core/udev/udev-extraconf/mount.sh +++ b/meta/recipes-core/udev/udev-extraconf/mount.sh @@ -27,6 +27,22 @@ automount() { MOUNT="$MOUNT -o silent" fi + # Setting for rootless X + if [ -f /etc/X11/Xusername ]; then + xusername="`cat /etc/X11/Xusername`" + case $ID_FS_TYPE in + # Such as fat12,fat16,fat32,vfat,msdos + vfat) + # Set the owner and group of the storage to xuser, only grant xuser + # with w/r/x permissions. + MOUNT="$MOUNT -o uid=`id "$xusername" -u`,gid=`id "$xusername" -g`,umask=077" + ;; + *) + # TODO + ;; + esac + fi + if ! $MOUNT -t auto $DEVNAME "/media/$name" then #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!" -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] udev-extraconf:fix rootless X write to usb storage failed 2013-04-28 8:14 ` [PATCH 1/1] udev-extraconf:fix " Hongxu Jia @ 2013-04-29 10:13 ` Burton, Ross 2013-04-29 19:33 ` Otavio Salvador 0 siblings, 1 reply; 4+ messages in thread From: Burton, Ross @ 2013-04-29 10:13 UTC (permalink / raw) To: Hongxu Jia; +Cc: openembedded-core On 28 April 2013 09:14, Hongxu Jia <hongxu.jia@windriver.com> wrote: > Rootless X is owned by xuser, the problem is xuser could not have > permissions to write to the usb storage when the file system is > vfat(fat16/fat32): Did I miss something, but why not use a disk group that the xuser has access to? I don't really like tying the automounter to the exact configuration of the X server, especially when this will break again if the user is using a non-root Wayland session. Ubuntu can set the user to the current user because as you say, the user environment is doing the mounting. At the moment, we don't have that. Ross ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] udev-extraconf:fix rootless X write to usb storage failed 2013-04-29 10:13 ` Burton, Ross @ 2013-04-29 19:33 ` Otavio Salvador 0 siblings, 0 replies; 4+ messages in thread From: Otavio Salvador @ 2013-04-29 19:33 UTC (permalink / raw) To: Burton, Ross; +Cc: Patches and discussions about the oe-core layer On Mon, Apr 29, 2013 at 7:13 AM, Burton, Ross <ross.burton@intel.com> wrote: > On 28 April 2013 09:14, Hongxu Jia <hongxu.jia@windriver.com> wrote: >> Rootless X is owned by xuser, the problem is xuser could not have >> permissions to write to the usb storage when the file system is >> vfat(fat16/fat32): > > Did I miss something, but why not use a disk group that the xuser has > access to? I don't really like tying the automounter to the exact > configuration of the X server, especially when this will break again > if the user is using a non-root Wayland session. > > Ubuntu can set the user to the current user because as you say, the > user environment is doing the mounting. At the moment, we don't have > that. You might want to look at pmount. It is an easy way to handle it without udisks. https://launchpad.net/pmount -- Otavio Salvador O.S. Systems E-mail: otavio@ossystems.com.br http://www.ossystems.com.br Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-04-29 19:51 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-04-28 8:14 [PATCH 0/1 V3]udev-extraconf:fix rootless X write to usb storage failed Hongxu Jia 2013-04-28 8:14 ` [PATCH 1/1] udev-extraconf:fix " Hongxu Jia 2013-04-29 10:13 ` Burton, Ross 2013-04-29 19:33 ` Otavio Salvador
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox