On Thu, Feb 13, 2003 at 12:00:10PM +0100, [EMAIL PROTECTED] wrote:
>
>--DIOMP1UsTsWJauNi
>Content-Type: text/plain; charset=us-ascii
>Content-Disposition: inline
>Content-Transfer-Encoding: quoted-printable
>
>On Tue, Feb 11, 2003, [EMAIL PROTECTED] wrote:
>> Does openpkg's rc script depend on /usr/ucb/whoami ? Is there a better wa=
>y to
>> check simply that a user has effective id root? I'd like to avoid having =
>to add
>> /usr/ucb to root's PATH if possible, and more importantly avoid probs wit=
>h 'su'
>> vs. 'su -', etc.
>>
>[...]
>>
>> # who am i
>> guest      pts/4        Feb  9 19:37    (laptop-a)
>> # whoami
>> root
>> #=20
>
>Hello Vinod,

>Yes, this is a known problem. Today's OpenPKG 'rc' bourne shell bundled
>with OpenPKG 1.[0-2] prefers 'whoami' to discover the username, but will
>use 'who' as the next alternative. It seems that you've learned this
>yourself the hard way, because running 'who am i' does not return the
>correct username in some cases.

May I suggest using the ``id'' program in place of ``who'' or ``whoami''
(it's already in the coreutils and could be added to the bootstrap
binaries)?  The ``id'' program is far more flexible, returning numric uid,
gid, or names depending on the options.  At least on Linux systems, it's
well integrated with the underlying authentication method, using
/etc/nsswitch.conf, to return the appropriate information from files, nis,
ldap, etc. as necessary.

Using ``id'' would also simplify several of the macros and methods used
during the bootstrap process that now use a combination of cat, ypcat,
grep, and awk to extract this information from the system.

        whoami -> id -un
        %define l_muid  %(id -u %{l_musr})
        %define l_mgid  %(id -g %{l_musr})
        %define l_mgrp  %(id -gn %{l_musr})

>I expect that a fully rewritten 'rc' program will be bundled with OpenPKG
>2= .0, and the bug you reported will then be solved. Until then, the work
>around is to truly log in as root or have the 'whoami' command appear
>before 'who' according to the PATH variable of your environment.

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

Cutting the space budget really restores my faith in humanity.  It
eliminates dreams, goals, and ideals and lets us get straight to the
business of hate, debauchery, and self-annihilation.
                -- Johnny Hart
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
Developer Communication List                   [EMAIL PROTECTED]

Reply via email to