On Thu, 5 Jan 2006, Eric Blake wrote:

> According to Igor Peshansky on 1/5/2006 3:37 PM:
> > Hi,
> >
> > 'su' used to be an executable that worked correctly from a SYSTEM-owned
> > shell, but now it's a shell script that simply prints a "not supported"
> > message.  Is it possible to resurrect the old "su" executable (that
> > perhaps prints the same message if run from a non-SYSTEM account)?
>
> Coreutils certainly builds an su executable, but the cygwin distro of su
> has been a script since at least 5.2.1 when Corinna was the maintainer; I
> only enhanced the script to be a little more useful.

Right.  In fact, Googling for "sysbash" unearthed this message:
<http://cygwin.com/ml/cygwin/2004-10/msg00900.html> (though Corinna did
miss the one use for "su" that I mention below -- that is, switching user
context without a password if unable to start a service).

> I'll see what I can do about getting the executable built and running,
> but no promise on a timeline;

Thanks, I appreciate it.  There's not that much rush (I mean, after all, I
can build it myself if an urgent need arises), but it would be nice to
have.

> is there any easy run-time test as to whether the current user is SYSTEM
> and should try to perform user switching, vs. normal users to print a
> warning message that su is relatively useless under cygwin/Windows
> semantics?

Well, you can either test for UID 18 (bad) or actually try switching the
user's context and then checking that it succeeded (good).

> Also, be aware that there has been talk (but so far, no action) on the
> bug-coreutils list about dropping su from coreutils altogether, since
> there are other open source implementations of su available in other
> projects, and since it is so hard to maintain in a generic manner.

Heh.  Did they happen to mention exactly which projects have the su
implementations?

> > This was the only convenient command-line way I knew to test the
> > behavior of passwordless user switching from a SYSTEM shell...  I
> > would also be happy with alternative means for doing that.
>
> I guess that means I will finally have to figure out how to set up my
> own sysbash to also test this.  Meanwhile, if you download the cygwin
> coreutils src tarball, the su executable IS built, just not installed.

I posted the original shortcut in
<http://cygwin.com/ml/cygwin/2004-08/msg01132.html>, but here's a new and
improved version (with at least one bug fix):

C:\cygwin\bin\bash.exe -c "at $(date +%H):$((10#$(date +%M) + 1)) /interactive 
'c:\cygwin\bin\bash.exe' --login -i; S=$((60 - 10#$(date +%S))); while [ $S -ne 
0 ]; do echo -ne 'Please wait '$S' seconds for the shell \r'; sleep 1; S=$(($S 
- 1)); done"

I set the Window layout to 38x1, which gives me a nice countdown to when
the SYSTEM shell will pop up (though due to various factors, the countdown
sometimes lags behind slightly).
HTH,
        Igor
-- 
                                http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_            [EMAIL PROTECTED] | [EMAIL PROTECTED]
ZZZzz /,`.-'`'    -.  ;-;;,_            Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'           old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL     a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to