Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Feb 2006 15:09:14 +0100 (CET)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-stable@FreeBSD.ORG
Subject:   Re: Trouble with mounting USB stick as user
Message-ID:  <200602091409.k19E9Edc013703@lurza.secnetix.de>
In-Reply-To: <43EA5DE1.9090803@gmx.de>

next in thread | previous in thread | raw e-mail | index | archive | help
[LoN]Kamikaze <LoN_Kamikaze@gmx.de> wrote:
 > Oliver Fromme wrote:
 > > [LoN]Kamikaze <LoN_Kamikaze@gmx.de> wrote:
 > > > I think it's enough when the mount point is owned by the group, without
 > > > belonging to a user. Try:
 > > > # chown :operator /mountpoint
 > > > # chmod 0770 /mountpoint
 > > 
 > > No.  The mount point _must_ be owned by the user.
 > > 
 > > How many times does that have to be repeated until
 > > people get it?  :-)
 > 
 > So why does it work fine on my system?

I don't know.  You either modified the kernel sources so it
works with the group alone, or you are confusing things.

The source code is pretty clear.  The following excerpt is
verbatim (including comment) from src/sys/kern/vfs_mount.c
which implements the mount() syscall.

        /*
         * If the user is not root, ensure that they own the directory
         * onto which we are attempting to mount.
         */
        error = VOP_GETATTR(vp, &va, td->td_ucred, td);
        if (error) {
                vput(vp);
                return (error);
        }
        if (va.va_uid != td->td_ucred->cr_uid) {
                if ((error = suser(td)) != 0) {
                        vput(vp);
                        return (error);
                }
        }

Note that the UID attribute (va_uid) of the vnode which
represents the mount point (vp) is compared with the UID
of the user credentials (cr_uid) from the current thread
(td).  No GIDs involved here, only UIDs.

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"... there are two ways of constructing a software design:  One way
is to make it so simple that there are _obviously_ no deficiencies and
the other way is to make it so complicated that there are no _obvious_
deficiencies."        -- C.A.R. Hoare, ACM Turing Award Lecture, 1980



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602091409.k19E9Edc013703>