From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-user+bounces-138544-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1SX1ry-0007Rs-SZ
	for garchives@archives.gentoo.org; Wed, 23 May 2012 03:04:15 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id D1B26E002C
	for <garchives@archives.gentoo.org>; Wed, 23 May 2012 03:04:13 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id 7149FE0767
	for <gentoo-user@lists.gentoo.org>; Wed, 23 May 2012 00:27:13 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by smtp.gentoo.org (Postfix) with ESMTP id BC5E91B400C
	for <gentoo-user@lists.gentoo.org>; Wed, 23 May 2012 00:27:12 +0000 (UTC)
X-Virus-Scanned: by amavisd-new using ClamAV at gentoo.org
X-Spam-Flag: NO
X-Spam-Score: -2.534
X-Spam-Level:
X-Spam-Status: No, score=-2.534 tagged_above=-999 required=5.5
	tests=[AWL=0.067, BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7,
	SPF_PASS=-0.001] autolearn=no
Received: from smtp.gentoo.org ([127.0.0.1])
	by localhost (smtp.gentoo.org [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id Ybn3_36a38tL for <gentoo-user@lists.gentoo.org>;
	Wed, 23 May 2012 00:27:03 +0000 (UTC)
Received: from ironport-out.teksavvy.com (ironport-out.teksavvy.com [206.248.143.162])
	by smtp.gentoo.org (Postfix) with ESMTP id F08BD1B4008
	for <gentoo-user@gentoo.org>; Wed, 23 May 2012 00:27:01 +0000 (UTC)
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AgoKAG6Zu0/O+J0S/2dsb2JhbABEsnYDgRiBCIJWHHImJSQTiA6YUqE3i2KEAGIDjT6HXIVfiDqBWIMF
X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; 
   d="scan'208";a="181872997"
Received: from 206-248-157-18.dsl.teksavvy.com (HELO waltdnes.org) ([206.248.157.18])
  by ironport2-out.teksavvy.com with SMTP; 22 May 2012 20:26:59 -0400
Received: by waltdnes.org (sSMTP sendmail emulation); Tue, 22 May 2012 20:26:03 -0400
From: "Walter Dnes" <waltdnes@waltdnes.org>
Date: Tue, 22 May 2012 20:26:03 -0400
To: Gentoo Users List <gentoo-user@lists.gentoo.org>
Subject: [gentoo-user] OT: mount so that other users can write to mounted dir?
Message-ID: <20120523002603.GA4469@waltdnes.org>
Precedence: bulk
List-Post: <mailto:gentoo-user@lists.gentoo.org>
List-Help: <mailto:gentoo-user+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-user+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-user+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-user.gentoo.org>
X-BeenThere: gentoo-user@lists.gentoo.org
Reply-to: gentoo-user@lists.gentoo.org
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Archives-Salt: f3aa53cd-f24e-4eb2-9444-6afd5c24de44
X-Archives-Hash: ef27967c6de013184bb2c08d931e3fe5

  I'm not really a fan of automount, but I understand that lots of
people are.  I'm trying to get it fully functional under mdev, and then
do a write-up on the wiki page.  A Google search turns up lots of
examples of code.  However, the examples are for embedded devices, and
they assume the only user is root.  I've got the automounting and
autounmounting working.  Everybody can read the mounted USB stick, but
only root can write.  I've tried pmount with the umask option, but it
doesn't help.  Assume the scrpt gets passed MDEV="sdb1"

#
# Create the directory in /media
   mkdir -p /media/${MDEV}
#
# Change permissions to allow read+write by all
   chmod 777 /media/${MDEV}
#
# Mount the directory in /media
   pmount  --noatime --umask 000 /dev/${MDEV}

  But after the mount...
user2@aa1 /media $ ll
total 3
drwxr-xr-x  3 root root 1024 May 22 19:02 .
drwxr-xr-x 19 root root 1024 May 21 20:41 ..
drwxr-xr-x  5 root root 1024 May 16 01:42 sdb1

  Every directory and file belongs to user:group root:root.  On the USB
stick all directories are 755 and files are 744.  As a heavy-handed ugly
hack, I could...

chgrp -R users /media/${MDEV}
chmod -R g+w /media/${MDEV}

to a USB stick.  I obviously don't wnt to do that on the external USB
drive that I rsync my system to every few weeks.  Any ideas?  And oh
yes, I do realize I'm trying to re-invent the wheel.  The old one has
a broken udev :(

-- 
Walter Dnes <waltdnes@waltdnes.org>