Cygwin bash "id -un" returns "Administrator" when I'm not

Cygwin bash "id -un" returns "Administrator" when I'm not

Post by Charles Colli » Thu, 25 Apr 2002 04:16:08



I'm logged in to my Win XP machine as, e.g., DOMAIN\someUser, but
"id -un" from any Cygwin bash shell returns "Administrator".

Is this wrong, or am I missing something? Shouldn't it return
"someUser"?

The userid DOMAIN\someUser is a member of the local Administrators
group. Does that matter?

 
 
 

Cygwin bash "id -un" returns "Administrator" when I'm not

Post by Peter J. Ackl » Sun, 28 Apr 2002 18:10:28



> I'm logged in to my Win XP machine as, e.g., DOMAIN\someUser, but
> "id -un" from any Cygwin bash shell returns "Administrator".

> Is this wrong, or am I missing something? Shouldn't it return
> "someUser"?

If you check your environment variables, I'll be you'll see one
named USER and one named USERNAME.  And I guess "id -un" gets the
username from the wrong variable.

I know that if you use \u in a prompt string, then it will get the
username from the USER environment variable, but the Windows login
name is in the USERNAME environment variable, so in my
~/.bash_profile i have

    #
    # The \u in the prompt is based on the USER variable, but use
    # the USERNAME variable instead, if non-empty.
    #
    USER=${USER:-$USERNAME}

Did this help?

Peter

--
Where do bit streams end?  In bit rivers?

 
 
 

Cygwin bash "id -un" returns "Administrator" when I'm not

Post by Juha Laih » Sun, 28 Apr 2002 19:32:01




>> I'm logged in to my Win XP machine as, e.g., DOMAIN\someUser, but
>> "id -un" from any Cygwin bash shell returns "Administrator".

>> Is this wrong, or am I missing something? Shouldn't it return
>> "someUser"?

I think it should. I my account name when logged on to my W98.

Quote:>If you check your environment variables, I'll be you'll see one
>named USER and one named USERNAME.  And I guess "id -un" gets the
>username from the wrong variable.

At least on unix side, id doesn't rely on the environment; it uses the
OS calls (which also don't rely on the environment variables). I don't
know what would be the corresponding Win32 calls, and whether or not
they rely on the environment variables.

Also, id is a standalone program, and not dependent on bash, so bash has
no function here.
--
Wolf  a.k.a.  Juha Laiho     Espoo, Finland

         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)

 
 
 

Cygwin bash "id -un" returns "Administrator" when I'm not

Post by Peter J. Ackl » Sun, 28 Apr 2002 20:23:55



> Also, id is a standalone program, and not dependent on bash, so
> bash has no function here.

True, but for all I know, id on Cygwin uses environment variables
as a fall-back method, and .bash_profile is a reasonable place to
set environment variables.

Peter

--
Where do bit streams end?  In bit rivers?

 
 
 

Cygwin bash "id -un" returns "Administrator" when I'm not

Post by Charles Colli » Thu, 02 May 2002 01:25:27


Actually, what led me down this path in the first place was the
following code in the Cygwin /etc/profile:

#--------------------------------
USER="`id -un`"

# Set up USER's home directory
if [ -z "$HOME" ]; then
  HOME="/home/$USER"
fi
#--------------------------------

My home directory was always being set to /home/Administrator. Yeah, I
override this, now that I see what's happening, but ...

USERNAME appears to be correct in the Cygwin environment, i.e.,
someUser -- same as in the Windows environment.

Still mystified,

Charles

 
 
 

1. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""

My machine: P166+mmx, 32mb ram, 4gb HD with Win95 and Win NT 4.0 and
redhat5.1 co-existed in different partitions.

I issued "sndconfig" within a xterm inside X Window, The program
detects the SB 16 pnp card sets it up with no error message, but when
it launch ModProbe to test out, it gets a message states: An error was
encountered running the ModProbe program."  I tried different IRQ
settings, all ends with the same message.

2nd, When I try to mount /dev/cdrom from File Systerm Manager, the
following error is returned:  Can't find /dev/hdb in /etc/mtab or
/etc/fstab.

3nd, When my machine boots, it halts at "Sendmail" for about 3-5 mins
before it goes to next step.  Obviously there isn't any mail system on
the machine right now because it is a standalone.  How can take this
mail thing out and speed up booting?

last one, Is my Zoom 56k PCI FaxModem a Windmodem that Linux can't use
to connect me to my local isp?

Experts help me out please. thanks.

2. Big Harddisk (Matrox, 120 GB)

3. GETSERVBYNAME()????????????????????"""""""""""""

4. How to dissociate a child process from its parent?

5. Any un"rm" and un"mkfs" tools ??

6. TCP Connection come up halfway, Why?

7. CygWin - PATH finds "myscript.sh" but not "myscript"

8. any way to use multiple displays from a single ODT system

9. Type "(", ")" and "{", "}" in X...

10. Does select return "read ready" or "won't block" status?

11. startx returns errors "Not a declared device" or "Chipset string expected"

12. "umsdos" vs "vfat" vs "looped ext2"

13. "Novell-like","non-TCP/IP","networking" OS to place Unix