Bug 20410

Summary: RFE: mount dirs with permissions of the device
Product: [Retired] Red Hat Linux Reporter: Gerald Teschl <gt>
Component: autofsAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED NOTABUG QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: leonb
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-05-25 13:18:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Automount script that copies the device permissions
none
Fixed version (previous had garbage after the doc)
none
Autofs script that automounts devices with correct ownership none

Description Gerald Teschl 2000-11-06 08:55:50 UTC
The RedHat login scripts make sure that several devices (like floppy
drives)
belong to the console user. I'd like to use autofs for floppy drives and
it would be nice if the floppy would be mounted with the owner permissions
(rather than root).

(I also sent this request to Peter Alvin.)

Comment 1 leonb 2001-06-20 15:00:25 UTC
Created attachment 21385 [details]
Automount script that copies the device permissions

Comment 2 leonb 2001-06-20 15:03:34 UTC
I just attached a script ``auto.mnt" that works with autofs 
to mount the removable devices under ./mnt.

The script scans the fstab file for entries with
a matching mount point and options "user" and "noauto".

It also understand option "owner" and interprets it by
adding a "uid=" and "gid=" in such a way that
the filesystem owner matches the device owner.

% ls -l /mnt/floppy
total 48
-rw-r--r--    1 leonb    floppy      46194 Jun 19 17:24 arbib.tgz
-rw-r--r--    1 leonb    floppy        252 Jun 19 18:03 auto.master
-rw-r--r--    1 leonb    floppy       1561 Jun 20 06:26 auto.mnt



Comment 3 leonb 2001-06-20 15:34:10 UTC
Created attachment 21386 [details]
Fixed version (previous had garbage after the doc)

Comment 4 Gerald Teschl 2001-06-20 18:43:47 UTC
I currently use Take/GiveConsole to do a similar thing:

MYUID=`id -u $USER`
MYGID=`id -g $USER`
sed "s/uid=[0-9]*/uid=$MYUID/g;s/gid=[0-9]*/gid=$MYGID/g" /etc/auto.mnt >
/etc/auto.mnt.
mv -f /etc/auto.mnt. /etc/auto.mnt

Comment 5 leonb 2001-06-20 20:55:55 UTC
> I currently use Take/GiveConsole to do a similar thing.

My auto.mnt is not a data file but an executable script.
There is no need to replicate the list of removable devices.
It only uses the usual fstab entries to determine the mount
line and make everything happens.  That includes the insertion 
of the uid= and gid= option (when option "owner" is specified).

For instance, inserting /etc/auto.mnt and the corresponding
/etc/auto.master line in the autofs-xxx.rpm would make linux mount 
all removeable devices listed in fstab on demand, with the 
proper uid/gid options.  No configuration necessary.

- L.


Comment 6 leonb 2001-06-26 14:23:03 UTC
Created attachment 21850 [details]
Autofs script that automounts devices with correct ownership

Comment 7 leonb 2001-06-26 14:24:32 UTC
Just attached an improved version of the script.
This version relies less on bash oddities
and works properly when the user does not own
the device.



Comment 8 Gerald Teschl 2002-05-25 13:18:52 UTC
I think the proper way to solve this is by adding an option to
mount which causes the fs to be mounted with the permissions of
the device. See #45166