Skip to contentSkip to conversation

fix rootless X write to usb storage failed

PATCH New Hongxu Jia 1 participant 3 messages Jul 16, 2013

lore
Share & tools
lore

Hongxu Jia

author
#0 lore raw

v2 cover fix rootless X write to usb storage failed

Change from V1:
* Drop pmount, and investigate udev script to fix this problem.

Hi Paul and Ross,

Thanks for your valuable suggestions, I send another solution to you for reviewing and would you please give me your advise.

If you have a better idea, would you please share with us.

By the way, I also try another solution which is to modify util-mount to allow normal user (non root) to invoke mount/umount to mount a filesystem, but I think it's not good because it has security issue.

Thanks,
Hongxu

The following changes since commit a63229917a5708de2d161aba0d67168ce0da6365:

meta-yocto-bsp: update reference board SRCREVs (2013-07-10 09:45:51 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib hongxu/fix-fat
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-fat

Hongxu Jia (2):
udev-extraconf: allow users in disk group to write vfat filesystem
xuser-account: add xuser to disk group

 meta/recipes-core/udev/udev-extraconf/mount.sh          | 11 +++++++++++
 meta/recipes-support/user-creation/xuser-account_0.1.bb |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH v2 1/2 udev-extraconf: allow users in disk group to write vfat filesystem

If filesystem type is vfat, change the ownership group to 'disk', and grant it with w/r/x permissions.

The user which belongs to 'disk' group could write the storage.

[YOCTO #4004]

---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
meta/recipes-core/udev/udev-extraconf/mount.sh +11 -0
index d1419ed..327cfc6 100644
@@ -27,6 +27,17 @@ automount() {
 		MOUNT="$MOUNT -o silent"
 	fi
 	
+	# If filesystem type is vfat, change the ownership group to 'disk', and
+	# grant it with  w/r/x permissions.
+	case $ID_FS_TYPE in
+	vfat|fat)
+		MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' /etc/group`"
+		;;
+	# TODO
+	*)
+		;;
+	esac
+
 	if ! $MOUNT -t auto $DEVNAME "/media/$name"
 	then
 		#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!"
Signature · 1 line
1.8.1.2
author
#2 lore raw

PATCH v2 2/2 xuser-account: add xuser to disk group

In reply to Hongxu Jia

Add xuser to disk group, so it could write usb storage in which the filesystem type is vfat/fat.

[YOCTO #4004]

---
 meta/recipes-support/user-creation/xuser-account_0.1.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-support/user-creation/xuser-account_0.1.bb +1 -1
index a7575a4..58e8139 100644
@@ -21,7 +21,7 @@ do_install() {
 USERADD_PACKAGES = "${PN}"
 GROUPADD_PARAM_${PN} = "--system shutdown"
 USERADD_PARAM_${PN} = "--create-home \
-                       --groups video,tty,audio,input,shutdown \
+                       --groups video,tty,audio,input,shutdown,disk \
                        --user-group xuser"
 
 ALLOW_EMPTY_${PN} = "1"
Signature · 1 line
1.8.1.2