Re: [gentoo-user] User can mount/umount but not write to top the new drive

2012-04-10 Thread Stroller

On 9 April 2012, at 20:59, Mark Knecht wrote:
 … 
  In the past I've gotten around this by having root mount the drive
 and then change ownership to mark:users once it's mounted. Linux
 remembers I've done that once and no longer requires me to do anything
 else as root.
 
   Is that truly required or is there a way to give the user access to
 the top of the new mount point without roots' involvement?


I recall having exactly this problem years ago, and having had it explained to 
me here on this list.

I'm sure that if you *once* chmod / chown as root, then the permissions will be 
remembered correctly forever after. If you unmount and remount the drive, 
reboot the computer or whatever, the user will be able to write to the drive.

Do double  triple check this because, although I'm certainly fallible, I feel 
certain of this.

If I'm mistaken I guess you could do something involving udev mounting rules.

Note that if you use the same USB drive on different computers (or dual-boot 
different distros) then you have to be aware of user name vs. user ID number.

Stroller.




Re: [gentoo-user] User can mount/umount but not write to top the new drive

2012-04-10 Thread Alan McKinnon
On Tue, 10 Apr 2012 12:18:38 +0100
Stroller strol...@stellar.eclipse.co.uk wrote:

 
 On 9 April 2012, at 20:59, Mark Knecht wrote:
  … 
   In the past I've gotten around this by having root mount the drive
  and then change ownership to mark:users once it's mounted. Linux
  remembers I've done that once and no longer requires me to do
  anything else as root.
  
Is that truly required or is there a way to give the user access
  to the top of the new mount point without roots' involvement?
 
 
 I recall having exactly this problem years ago, and having had it
 explained to me here on this list.
 
 I'm sure that if you *once* chmod / chown as root, then the
 permissions will be remembered correctly forever after. If you
 unmount and remount the drive, reboot the computer or whatever, the
 user will be able to write to the drive.
 
 Do double  triple check this because, although I'm certainly
 fallible, I feel certain of this.
 
 If I'm mistaken I guess you could do something involving udev
 mounting rules.
 
 Note that if you use the same USB drive on different computers (or
 dual-boot different distros) then you have to be aware of user name
 vs. user ID number.
 
 Stroller.
 
 

You are correct. 

chown the mount point and the top-level . directory on the disk and
that is what is used in future.

Fancy software like udev and DEs may undo all of that work, but without
their input the above is what works.




-- 
Alan McKinnnon
alan.mckin...@gmail.com




[gentoo-user] User can mount/umount but not write to top the new drive

2012-04-09 Thread Mark Knecht
Hi,
   This has long been a sort of hack area of me in terms of sys admin
at home - giving a user account access to the top of a new external
drive. I'd like to learn to do this right. Maybe someone can set me
straight about what root needs to do to make this work.

   OK, so as root I partition  format the USB drive to get it ready,
and then I modify fstab with the following addition:

c2stable ~ # cat /etc/fstab | grep VideoLib
LABEL=VideoLib  /mnt/VideoLib   ext3
auto,rw,users 0 0
c2stable ~ #

   Having done that, as well as making the /mnt/VideoLib mount point,
my user account can now mount  umount the drive:

mark@c2stable ~ $ mount /mnt/VideoLib/
mark@c2stable ~ $ df -h | grep VideoLib
/dev/sdf1   458G  199M  435G   1% /mnt/VideoLib
mark@c2stable ~ $ umount /mnt/VideoLib/
mark@c2stable ~ $ df -h | grep VideoLib
mark@c2stable ~ $

   The problem is that at this point my user account cannot create a
new directory on that drive:

mark@c2stable ~ $ mount /mnt/VideoLib/
mark@c2stable ~ $ df -h | grep VideoLib
/dev/sdf1   458G  199M  435G   1% /mnt/VideoLib
mark@c2stable ~ $ mkdir /mnt/VideoLib/Video
mkdir: cannot create directory `/mnt/VideoLib/Video': Permission denied
mark@c2stable ~ $

   In the past I've gotten around this by having root mount the drive
and then change ownership to mark:users once it's mounted. Linux
remembers I've done that once and no longer requires me to do anything
else as root.

   Is that truly required or is there a way to give the user access to
the top of the new mount point without roots' involvement?

Thanks,
Mark



Re: [gentoo-user] User can mount/umount but not write to top the new drive

2012-04-09 Thread Canek Peláez Valdés
On Mon, Apr 9, 2012 at 2:59 PM, Mark Knecht markkne...@gmail.com wrote:
 Hi,
   This has long been a sort of hack area of me in terms of sys admin
 at home - giving a user account access to the top of a new external
 drive. I'd like to learn to do this right. Maybe someone can set me
 straight about what root needs to do to make this work.

   OK, so as root I partition  format the USB drive to get it ready,
 and then I modify fstab with the following addition:

 c2stable ~ # cat /etc/fstab | grep VideoLib
 LABEL=VideoLib          /mnt/VideoLib           ext3
 auto,rw,users 0 0
 c2stable ~ #

   Having done that, as well as making the /mnt/VideoLib mount point,
 my user account can now mount  umount the drive:

 mark@c2stable ~ $ mount /mnt/VideoLib/
 mark@c2stable ~ $ df -h | grep VideoLib
 /dev/sdf1       458G  199M  435G   1% /mnt/VideoLib
 mark@c2stable ~ $ umount /mnt/VideoLib/
 mark@c2stable ~ $ df -h | grep VideoLib
 mark@c2stable ~ $

   The problem is that at this point my user account cannot create a
 new directory on that drive:

 mark@c2stable ~ $ mount /mnt/VideoLib/
 mark@c2stable ~ $ df -h | grep VideoLib
 /dev/sdf1       458G  199M  435G   1% /mnt/VideoLib
 mark@c2stable ~ $ mkdir /mnt/VideoLib/Video
 mkdir: cannot create directory `/mnt/VideoLib/Video': Permission denied
 mark@c2stable ~ $

   In the past I've gotten around this by having root mount the drive
 and then change ownership to mark:users once it's mounted. Linux
 remembers I've done that once and no longer requires me to do anything
 else as root.

   Is that truly required or is there a way to give the user access to
 the top of the new mount point without roots' involvement?

Have you tried:

# cat /etc/fstab | grep VideoLib
LABEL=VideoLib          /mnt/VideoLib           ext3
auto,rw,users,uid=X,gid=Y 0 0

where X is mark's user id, and Y is users' group id?

On the other hand, do you use a desktop environment? Because GNOME
does everything you want for you, and I suppose KDE does the same.

Regards.
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México



Re: [gentoo-user] User can mount/umount but not write to top the new drive

2012-04-09 Thread Neil Bothwick
On Mon, 9 Apr 2012 12:59:31 -0700, Mark Knecht wrote:

In the past I've gotten around this by having root mount the drive
 and then change ownership to mark:users once it's mounted. Linux
 remembers I've done that once and no longer requires me to do anything
 else as root.

That's right, the root of the filesystem is now owned by mark.

Is that truly required or is there a way to give the user access to
 the top of the new mount point without roots' involvement?

Not with a Linux filesystem[1][2], because the filesystem is owned by
root, so only root can change that.

[1] This isn't strictly true as you can do it with ACLs, but that is far
more complex than simply chowning the root of the filesystem if that is
all you need.

[2] With Windows filesystem, there are mount options to set the default
ownership, but that is a workaround for the differences between Linux and
Windows metadata.


-- 
Neil Bothwick

TROI : What am I sensing?? I'm sensing INCOMPETENCE, you pretentious
bald pseudo-French dickweed!


signature.asc
Description: PGP signature


Re: [gentoo-user] User can mount/umount but not write to top the new drive

2012-04-09 Thread Mark Knecht
On Mon, Apr 9, 2012 at 1:38 PM, Canek Peláez Valdés can...@gmail.com wrote:
 On Mon, Apr 9, 2012 at 2:59 PM, Mark Knecht markkne...@gmail.com wrote:
 Hi,
   This has long been a sort of hack area of me in terms of sys admin
 at home - giving a user account access to the top of a new external
 drive. I'd like to learn to do this right. Maybe someone can set me
 straight about what root needs to do to make this work.

   OK, so as root I partition  format the USB drive to get it ready,
 and then I modify fstab with the following addition:

 c2stable ~ # cat /etc/fstab | grep VideoLib
 LABEL=VideoLib          /mnt/VideoLib           ext3
 auto,rw,users 0 0
 c2stable ~ #

   Having done that, as well as making the /mnt/VideoLib mount point,
 my user account can now mount  umount the drive:

 mark@c2stable ~ $ mount /mnt/VideoLib/
 mark@c2stable ~ $ df -h | grep VideoLib
 /dev/sdf1       458G  199M  435G   1% /mnt/VideoLib
 mark@c2stable ~ $ umount /mnt/VideoLib/
 mark@c2stable ~ $ df -h | grep VideoLib
 mark@c2stable ~ $

   The problem is that at this point my user account cannot create a
 new directory on that drive:

 mark@c2stable ~ $ mount /mnt/VideoLib/
 mark@c2stable ~ $ df -h | grep VideoLib
 /dev/sdf1       458G  199M  435G   1% /mnt/VideoLib
 mark@c2stable ~ $ mkdir /mnt/VideoLib/Video
 mkdir: cannot create directory `/mnt/VideoLib/Video': Permission denied
 mark@c2stable ~ $

   In the past I've gotten around this by having root mount the drive
 and then change ownership to mark:users once it's mounted. Linux
 remembers I've done that once and no longer requires me to do anything
 else as root.

   Is that truly required or is there a way to give the user access to
 the top of the new mount point without roots' involvement?

 Have you tried:

 # cat /etc/fstab | grep VideoLib
 LABEL=VideoLib          /mnt/VideoLib           ext3
 auto,rw,users,uid=X,gid=Y 0 0

 where X is mark's user id, and Y is users' group id?

 On the other hand, do you use a desktop environment? Because GNOME
 does everything you want for you, and I suppose KDE does the same.

 Regards.
 --
 Canek Peláez Valdés
 Posgrado en Ciencia e Ingeniería de la Computación
 Universidad Nacional Autónoma de México


I had not tried those but they seem to cause problems so clearly I
don't have it right yet:

c2stable ~ # cat /etc/fstab | grep VideoLib
LABEL=VideoLib  /mnt/VideoLib   ext3
auto,rw,users,uid=1000,gid=100 0 0
c2stable ~ #

mark@c2stable ~ $ mount /mnt/VideoLib/
mount: wrong fs type, bad option, bad superblock on /dev/sdf1,
   missing codepage or helper program, or other error
   In some cases useful info is found in syslog - try
   dmesg | tail  or so

mark@c2stable ~ $

I tried both

uid=X,gid=Y

and

setuid=X,setgid=Y

Same results.

The man page sure reads like that should work but it didn't.

Thanks,
Mark



Re: [gentoo-user] User can mount/umount but not write to top the new drive

2012-04-09 Thread Mark Knecht
On Mon, Apr 9, 2012 at 1:48 PM, Neil Bothwick n...@digimed.co.uk wrote:
 On Mon, 9 Apr 2012 12:59:31 -0700, Mark Knecht wrote:

    In the past I've gotten around this by having root mount the drive
 and then change ownership to mark:users once it's mounted. Linux
 remembers I've done that once and no longer requires me to do anything
 else as root.

 That's right, the root of the filesystem is now owned by mark.

    Is that truly required or is there a way to give the user access to
 the top of the new mount point without roots' involvement?

 Not with a Linux filesystem[1][2], because the filesystem is owned by
 root, so only root can change that.

 [1] This isn't strictly true as you can do it with ACLs, but that is far
 more complex than simply chowning the root of the filesystem if that is
 all you need.

 [2] With Windows filesystem, there are mount options to set the default
 ownership, but that is a workaround for the differences between Linux and
 Windows metadata.


 --
 Neil Bothwick

 TROI : What am I sensing?? I'm sensing INCOMPETENCE, you pretentious
 bald pseudo-French dickweed!

Thanks Neil. I guess that unless we figure out Canek's uid/gid options
I'll stick with chown, etc.

Cheers,
Mark



Re: [gentoo-user] User can mount/umount but not write to top the new drive

2012-04-09 Thread Neil Bothwick
On Mon, 9 Apr 2012 14:23:13 -0700, Mark Knecht wrote:

  [2] With Windows filesystem, there are mount options to set the
  default ownership, but that is a workaround for the differences
  between Linux and Windows metadata.

 Thanks Neil. I guess that unless we figure out Canek's uid/gid options
 I'll stick with chown, etc.

The uid and gid options don't apply to ext? filesystems. Have another
look at the man page and you'll see they are only listed for some
non-Linux filesystems, in order to make them compatible with Linux
ownerships and permissions.


-- 
Neil Bothwick

God: What one human uses to persecute another.


signature.asc
Description: PGP signature


Re: [gentoo-user] User can mount/umount but not write to top the new drive

2012-04-09 Thread Canek Peláez Valdés
On Mon, Apr 9, 2012 at 4:39 PM, Neil Bothwick n...@digimed.co.uk wrote:
 On Mon, 9 Apr 2012 14:23:13 -0700, Mark Knecht wrote:

  [2] With Windows filesystem, there are mount options to set the
  default ownership, but that is a workaround for the differences
  between Linux and Windows metadata.

 Thanks Neil. I guess that unless we figure out Canek's uid/gid options
 I'll stick with chown, etc.

 The uid and gid options don't apply to ext? filesystems. Have another
 look at the man page and you'll see they are only listed for some
 non-Linux filesystems, in order to make them compatible with Linux
 ownerships and permissions.

Oh crap, you are totally right. Sorry for the noise.

Regards.
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México



Re: [gentoo-user] User can mount/umount but not write to top the new drive

2012-04-09 Thread Mark Knecht
On Mon, Apr 9, 2012 at 2:39 PM, Neil Bothwick n...@digimed.co.uk wrote:
 On Mon, 9 Apr 2012 14:23:13 -0700, Mark Knecht wrote:

  [2] With Windows filesystem, there are mount options to set the
  default ownership, but that is a workaround for the differences
  between Linux and Windows metadata.

 Thanks Neil. I guess that unless we figure out Canek's uid/gid options
 I'll stick with chown, etc.

 The uid and gid options don't apply to ext? filesystems. Have another
 look at the man page and you'll see they are only listed for some
 non-Linux filesystems, in order to make them compatible with Linux
 ownerships and permissions.


 --
 Neil Bothwick

 God: What one human uses to persecute another.

Apparently Canek  I do need to read more carefully. I just zoomed in
on the gid stuff from searching. I should have read the whole area.
Thanks

OK, so mounting the drive and chown-ing as root is indeed the right way to go.

Thanks,
Mark



Re: [gentoo-user] User can mount/umount but not write to top the new drive

2012-04-09 Thread Michael Mol
On Mon, Apr 9, 2012 at 5:39 PM, Neil Bothwick n...@digimed.co.uk wrote:
 On Mon, 9 Apr 2012 14:23:13 -0700, Mark Knecht wrote:

  [2] With Windows filesystem, there are mount options to set the
  default ownership, but that is a workaround for the differences
  between Linux and Windows metadata.

 Thanks Neil. I guess that unless we figure out Canek's uid/gid options
 I'll stick with chown, etc.

 The uid and gid options don't apply to ext? filesystems. Have another
 look at the man page and you'll see they are only listed for some
 non-Linux filesystems, in order to make them compatible with Linux
 ownerships and permissions.

Wouldn't it at least apply to the / mount point? (Which is the only
one at issue here, anyway...)

-- 
:wq