Gentoo Archives: gentoo-user

From: Mark Knecht <markknecht@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] User can mount/umount but not write to top the new drive
Date: Mon, 09 Apr 2012 21:23:54
Message-Id: CAK2H+eeE6Dd2TnABGGAk6+k3O_zbVLP69DTmW8Kk-vYePRqd3g@mail.gmail.com
In Reply to: Re: [gentoo-user] User can mount/umount but not write to top the new drive by "Canek Peláez Valdés"
1 On Mon, Apr 9, 2012 at 1:38 PM, Canek Peláez Valdés <caneko@×××××.com> wrote:
2 > On Mon, Apr 9, 2012 at 2:59 PM, Mark Knecht <markknecht@×××××.com> wrote:
3 >> Hi,
4 >>   This has long been a sort of hack area of me in terms of sys admin
5 >> at home - giving a user account access to the top of a new external
6 >> drive. I'd like to learn to do this right. Maybe someone can set me
7 >> straight about what root needs to do to make this work.
8 >>
9 >>   OK, so as root I partition & format the USB drive to get it ready,
10 >> and then I modify fstab with the following addition:
11 >>
12 >> c2stable ~ # cat /etc/fstab | grep VideoLib
13 >> LABEL=VideoLib          /mnt/VideoLib           ext3
14 >> auto,rw,users 0 0
15 >> c2stable ~ #
16 >>
17 >>   Having done that, as well as making the /mnt/VideoLib mount point,
18 >> my user account can now mount & umount the drive:
19 >>
20 >> mark@c2stable ~ $ mount /mnt/VideoLib/
21 >> mark@c2stable ~ $ df -h | grep VideoLib
22 >> /dev/sdf1       458G  199M  435G   1% /mnt/VideoLib
23 >> mark@c2stable ~ $ umount /mnt/VideoLib/
24 >> mark@c2stable ~ $ df -h | grep VideoLib
25 >> mark@c2stable ~ $
26 >>
27 >>   The problem is that at this point my user account cannot create a
28 >> new directory on that drive:
29 >>
30 >> mark@c2stable ~ $ mount /mnt/VideoLib/
31 >> mark@c2stable ~ $ df -h | grep VideoLib
32 >> /dev/sdf1       458G  199M  435G   1% /mnt/VideoLib
33 >> mark@c2stable ~ $ mkdir /mnt/VideoLib/Video
34 >> mkdir: cannot create directory `/mnt/VideoLib/Video': Permission denied
35 >> mark@c2stable ~ $
36 >>
37 >>   In the past I've gotten around this by having root mount the drive
38 >> and then change ownership to mark:users once it's mounted. Linux
39 >> remembers I've done that once and no longer requires me to do anything
40 >> else as root.
41 >>
42 >>   Is that truly required or is there a way to give the user access to
43 >> the top of the new mount point without roots' involvement?
44 >
45 > Have you tried:
46 >
47 > # cat /etc/fstab | grep VideoLib
48 > LABEL=VideoLib          /mnt/VideoLib           ext3
49 > auto,rw,users,uid=X,gid=Y 0 0
50 >
51 > where X is mark's user id, and Y is users' group id?
52 >
53 > On the other hand, do you use a desktop environment? Because GNOME
54 > does everything you want for you, and I suppose KDE does the same.
55 >
56 > Regards.
57 > --
58 > Canek Peláez Valdés
59 > Posgrado en Ciencia e Ingeniería de la Computación
60 > Universidad Nacional Autónoma de México
61 >
62
63 I had not tried those but they seem to cause problems so clearly I
64 don't have it right yet:
65
66 c2stable ~ # cat /etc/fstab | grep VideoLib
67 LABEL=VideoLib /mnt/VideoLib ext3
68 auto,rw,users,uid=1000,gid=100 0 0
69 c2stable ~ #
70
71 mark@c2stable ~ $ mount /mnt/VideoLib/
72 mount: wrong fs type, bad option, bad superblock on /dev/sdf1,
73 missing codepage or helper program, or other error
74 In some cases useful info is found in syslog - try
75 dmesg | tail or so
76
77 mark@c2stable ~ $
78
79 I tried both
80
81 uid=X,gid=Y
82
83 and
84
85 setuid=X,setgid=Y
86
87 Same results.
88
89 The man page sure reads like that should work but it didn't.
90
91 Thanks,
92 Mark