* [gentoo-user] User can mount/umount but not write to top the new drive @ 2012-04-09 19:59 Mark Knecht 2012-04-09 20:38 ` Canek Peláez Valdés ` (2 more replies) 0 siblings, 3 replies; 11+ messages in thread From: Mark Knecht @ 2012-04-09 19:59 UTC (permalink / raw To: Gentoo User 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] User can mount/umount but not write to top the new drive 2012-04-09 19:59 [gentoo-user] User can mount/umount but not write to top the new drive Mark Knecht @ 2012-04-09 20:38 ` Canek Peláez Valdés 2012-04-09 21:22 ` Mark Knecht 2012-04-09 20:48 ` Neil Bothwick 2012-04-10 11:18 ` Stroller 2 siblings, 1 reply; 11+ messages in thread From: Canek Peláez Valdés @ 2012-04-09 20:38 UTC (permalink / raw To: gentoo-user On Mon, Apr 9, 2012 at 2:59 PM, Mark Knecht <markknecht@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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] User can mount/umount but not write to top the new drive 2012-04-09 20:38 ` Canek Peláez Valdés @ 2012-04-09 21:22 ` Mark Knecht 0 siblings, 0 replies; 11+ messages in thread From: Mark Knecht @ 2012-04-09 21:22 UTC (permalink / raw To: gentoo-user On Mon, Apr 9, 2012 at 1:38 PM, Canek Peláez Valdés <caneko@gmail.com> wrote: > On Mon, Apr 9, 2012 at 2:59 PM, Mark Knecht <markknecht@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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] User can mount/umount but not write to top the new drive 2012-04-09 19:59 [gentoo-user] User can mount/umount but not write to top the new drive Mark Knecht 2012-04-09 20:38 ` Canek Peláez Valdés @ 2012-04-09 20:48 ` Neil Bothwick 2012-04-09 21:23 ` Mark Knecht 2012-04-10 11:18 ` Stroller 2 siblings, 1 reply; 11+ messages in thread From: Neil Bothwick @ 2012-04-09 20:48 UTC (permalink / raw To: gentoo-user [-- Attachment #1: Type: text/plain, Size: 1062 bytes --] 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! [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] User can mount/umount but not write to top the new drive 2012-04-09 20:48 ` Neil Bothwick @ 2012-04-09 21:23 ` Mark Knecht 2012-04-09 21:39 ` Neil Bothwick 0 siblings, 1 reply; 11+ messages in thread From: Mark Knecht @ 2012-04-09 21:23 UTC (permalink / raw To: gentoo-user On Mon, Apr 9, 2012 at 1:48 PM, Neil Bothwick <neil@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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] User can mount/umount but not write to top the new drive 2012-04-09 21:23 ` Mark Knecht @ 2012-04-09 21:39 ` Neil Bothwick 2012-04-09 21:42 ` Canek Peláez Valdés ` (2 more replies) 0 siblings, 3 replies; 11+ messages in thread From: Neil Bothwick @ 2012-04-09 21:39 UTC (permalink / raw To: gentoo-user [-- Attachment #1: Type: text/plain, Size: 654 bytes --] 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. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] User can mount/umount but not write to top the new drive 2012-04-09 21:39 ` Neil Bothwick @ 2012-04-09 21:42 ` Canek Peláez Valdés 2012-04-09 21:58 ` Mark Knecht 2012-04-09 22:45 ` Michael Mol 2 siblings, 0 replies; 11+ messages in thread From: Canek Peláez Valdés @ 2012-04-09 21:42 UTC (permalink / raw To: gentoo-user On Mon, Apr 9, 2012 at 4:39 PM, Neil Bothwick <neil@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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] User can mount/umount but not write to top the new drive 2012-04-09 21:39 ` Neil Bothwick 2012-04-09 21:42 ` Canek Peláez Valdés @ 2012-04-09 21:58 ` Mark Knecht 2012-04-09 22:45 ` Michael Mol 2 siblings, 0 replies; 11+ messages in thread From: Mark Knecht @ 2012-04-09 21:58 UTC (permalink / raw To: gentoo-user On Mon, Apr 9, 2012 at 2:39 PM, Neil Bothwick <neil@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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] User can mount/umount but not write to top the new drive 2012-04-09 21:39 ` Neil Bothwick 2012-04-09 21:42 ` Canek Peláez Valdés 2012-04-09 21:58 ` Mark Knecht @ 2012-04-09 22:45 ` Michael Mol 2 siblings, 0 replies; 11+ messages in thread From: Michael Mol @ 2012-04-09 22:45 UTC (permalink / raw To: gentoo-user On Mon, Apr 9, 2012 at 5:39 PM, Neil Bothwick <neil@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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] User can mount/umount but not write to top the new drive 2012-04-09 19:59 [gentoo-user] User can mount/umount but not write to top the new drive Mark Knecht 2012-04-09 20:38 ` Canek Peláez Valdés 2012-04-09 20:48 ` Neil Bothwick @ 2012-04-10 11:18 ` Stroller 2012-04-10 11:55 ` Alan McKinnon 2 siblings, 1 reply; 11+ messages in thread From: Stroller @ 2012-04-10 11:18 UTC (permalink / raw To: gentoo-user 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. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] User can mount/umount but not write to top the new drive 2012-04-10 11:18 ` Stroller @ 2012-04-10 11:55 ` Alan McKinnon 0 siblings, 0 replies; 11+ messages in thread From: Alan McKinnon @ 2012-04-10 11:55 UTC (permalink / raw To: gentoo-user; +Cc: stroller On Tue, 10 Apr 2012 12:18:38 +0100 Stroller <stroller@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.mckinnon@gmail.com ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-04-10 11:59 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-04-09 19:59 [gentoo-user] User can mount/umount but not write to top the new drive Mark Knecht 2012-04-09 20:38 ` Canek Peláez Valdés 2012-04-09 21:22 ` Mark Knecht 2012-04-09 20:48 ` Neil Bothwick 2012-04-09 21:23 ` Mark Knecht 2012-04-09 21:39 ` Neil Bothwick 2012-04-09 21:42 ` Canek Peláez Valdés 2012-04-09 21:58 ` Mark Knecht 2012-04-09 22:45 ` Michael Mol 2012-04-10 11:18 ` Stroller 2012-04-10 11:55 ` Alan McKinnon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox