From wihl@shore.net Fri 07 Jul 95 16:19:59
Path: shore!news3.near.net!paperboy.wellfleet.com!news-feed-1.peachnet.edu!gatech!gt-news!cc.gatech.edu!nin
From: nin@cc.gatech.edu (Derrick Whittle)
Newsgroups: comp.os.ms-windows.programmer.win32,comp.os.ms-windows.nt.misc
Subject: Re: LogonUser / UNIX-like su - Here is the answer
Followup-To: comp.os.ms-windows.programmer.win32,comp.os.ms-windows.nt.misc
Date: 7 Jul 1995 13:31:37 GMT
Organization: College of Computing, Georgia Tech
Lines: 44
Message-ID: <3tjcvp$m60@solaria.cc.gatech.edu>
References: <3te1th$d0u@shore.shore.net> <3thoeh$c0s@noc.tor.hookup.net>
NNTP-Posting-Host: felix.cc.gatech.edu
NNTP-Posting-User: nin
X-Newsreader: TIN [version 1.2 PL2]
Xref: shore comp.os.ms-windows.programmer.win32:23436 comp.os.ms-windows.nt.misc:69710

Brian F. Angus (bangus@hookup.net) wrote:
: In article <3te1th$d0u@shore.shore.net>, wihl@shore.net says...
: >
: >If you wanted an example of the NT Security APIs and a functioning
: >UNIX-like su (temporarily substitute user without logging out and in),
: >you will find the following example quite useful. This source plus
: >a binary (.EXE) have been uploaded to SimTel/nt as well.

: Hi,

: Just tried it out on NTW - works great.  If you are part of a domain, will
: it log you into the domain, or just the local workstation.  Also, it asks
: for a password, even if you are already logged in as Administrator (a little
: different than UNIX).  Can this be changed?

: Brian

  Su seems to work great, except I noticed one discrepancy.  If I su into 
another user, GetUserName() does give me the proper su'd user's name, so 
the process is running under the correct context.  However, if I su and 
start the Registry Editor, it doesn't work right.  Looking at HKEY_USERS, 
it has the normal .DEFAULT key, along with the S-1-5-... long 
descriptor.  But this descriptor matches who's logged in at the console, 
not who I'm su'd into.  In addition, HKEY_CURRENT_USER is neither the 
logged-in user or the su'd user, but instead it's actually .DEFAULT.  
This seems to be kind of strange behavior; what's Microsoft using to find 
the current user in regedt32?  It's returning Guest, or perhaps an error, 
pulling the default profile into HKEY_CURRENT_USER.  Anyone have ideas?
I am running NT 3.51 build 1057, so LogonUser and CreateProcessAsUser 
should work correctly, and I have all the appropriate priviledges (su 
does work for other applications).

   Also, could someone point me to the header files necessary to compile 
su?  I have Visual C++ 2.1, but LogonUser and CreateProcessAsUser aren't 
defined when I compile, along with related constants.

Thanks,
Derrick

--
Derrick Whittle
nin@felix.cc.gatech.edu
vaps4dw@prism.gatech.edu
gt3056a@prism.gatech.edu

From wihl@shore.net Sun 09 Jul 95 13:33:01
Path: shore!news3.near.net!paperboy.wellfleet.com!news-feed-1.peachnet.edu!hobbes.cc.uga.edu!cssun.mathcs.emory.edu!emory!swrinde!ihnp4.ucsd.edu!news1.ucsd.edu!desargues!danderso
From: danderso@ucsd.edu (Don Anderson)
Newsgroups: comp.os.ms-windows.programmer.win32,comp.os.ms-windows.nt.misc
Subject: Re: LogonUser / UNIX-like su - Here is the answer
Followup-To: comp.os.ms-windows.programmer.win32,comp.os.ms-windows.nt.misc
Date: 8 Jul 1995 17:51:16 GMT
Organization: A poorly-installed InterNetNews site
Lines: 16
Message-ID: <3tmgik$kej@news1.ucsd.edu>
References: <3te1th$d0u@shore.shore.net> <3thoeh$c0s@noc.tor.hookup.net> <3tjcvp$m60@solaria.cc.gatech.edu> <3tk4s2$slv@shore.shore.net>
NNTP-Posting-Host: desargues.ucsd.edu
X-Newsreader: TIN [version 1.2 PL2]
Xref: shore comp.os.ms-windows.programmer.win32:23514 comp.os.ms-windows.nt.misc:70104

I find one place where "su" doesn't work as I would have expected. If I
use it to launch "control", I seem to have my old identity. I can't do
things like change the startup behavior of services (and perhaps I can't
install and remove them - haven't tried that..). Is is possible that
"su" is not picking up some capability with respect to services that
administrators would pick up at a regular login?

--
------------------------------------------------------------
Don Anderson, Professor, Department of Computer Science and Engineering
University of California, San Diego
email: danderson@ucsd.edu
url: http://desargues.ucsd.edu/personal/dwa.html
phone: (619)534-1180
usmail: 0114 UCSD, 9500 Gilman Drive, La Jolla, CA 92093-0114
------------------------------------------------------------
