This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Making 'su' work under a cygwin bash shell


I have had only moderate success getting su.exe from the Windows 2000
Resource Kit working as a drop-in for the unix 'su' command.
The version of su.exe that I am using is one that is not yet publicly
available, but the issues still remain (I had to get the newer version to
fix another issue I was having).
************************************************************
SU for Windows NT v3.00 Jun 28 2000 19:48:15
(c) Copyright 1995, 1996, 1997.  Written by Scott Field
************************************************************

I don't know true shell scripting, so I wrote a simple perl script instead.
Assume the variables are defined correctly.
************************************************************
$ cat su2.pl
$user = 'Administrator';
$password = '********';
$domain = 'LocalHost';
$cygrootNT = 'C:\\cygwin';
$supathCYG = '/cygdrive/c/Program Files/Resource Kit';
open(PASSTMP,">/tmp/$user.password");
print PASSTMP $password;
close(PASSTMP);
print "\nAttemtping to execute the following:\n";
print "\"$supathCYG\\su.exe\" $user \"$cygrootNT\\bin\\bash.exe\" $domain -v
-e < \"$cygrootNT\\tmp\\$user.password\"\n";
system("\"$supathCYG\\su.exe\" $user \"$cygrootNT\\bin\\bash.exe\" $domain
-v -e < \"$cygrootNT\\tmp\\$user.password\"");
open(PASSTMP);
close(PASSTMP);
exit;
************************************************************

The script ~almost~ works as desired.  It runs the resultant bash prompt in
a new window.  I want to figure out how to make the new bash shell run
inside the bash shell it was run from.
Here is the output from when I run it:
************************************************************
$ perl su2.pl
Attempting to execute the following:
"/cygdrive/c/Program Files/Resource Kit\su.exe" Administrator
"C:\cygwin\bin\bash.exe" THIN-LINE -v -e <
"C:\cygwin\tmp\Administrator.password"
User=Administrator
Domain=LocalHost
ReferencedDomain=LocalHost
CommandLine=C:\cygwin\bin\bash.exe
TextualSid=S-1-5-21-1960408961-152049171-1060284298-500
LogonSid=S-1-5-5-0-7029156
CurrentWinsta+Desktop=WinSta0\Default
TargetWinsta+Desktop=WinSta0\Default
************************************************************

If anyone can tell me how to keep the shell in the same window, I'd be
appreciative.  Or if anyone knows of some version of su that works natively
under a cygwin bash shell, I'd be even more appreciative!

Thank you!

Jason R DePriest
First Tennessee National Corporation

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

The views and ideas expressed in this message, while not necessarily the
opinion of the parent organization, are none the less confidential and
intended only for the designated recipient.
If you want to disseminate the information, you must obtain permission from
the originating sender or from the Data Security department of First
Tennessee National Corporation.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]