logging in via telnet: no user environment variables; cscript can't be executed

Bernd Strobel bsmaillists@gmx.de
Sat Aug 10 20:42:00 GMT 2002


----- Original Message -----
From: "Andreas Wicker" <Andreas.Wicker@ids.de>
Newsgroups: gmane.os.cygwin
Sent: Tuesday, August 06, 2002 2:44 PM
Subject: Bug: logging in via telnet: no user environment variables; cscript
can't be executed


>
> When I log into a computer via cygwin telnet, I do get the system
> environment variables.
> But I do not get the user environment variables.

 I use ssh but it's the same with that.

> I'd propose to build it into cygwin that you get the user user variables
> when being logged in via telnet.

That's true.

> A workaround that I've used for this consisted of a VisualBasic-Script,
that
> was called in the /etc/profile and that copied the
> user-environment-variables to
> a little file which then was sourced from the /etc/profile.

I found this problem interesting and since I started using cygwin extensivly
recently, I assume I will run over this problem soon.

I tried this in my /etc/profile:

USERENV=/proc/registry/HKEY_CURRENT_USER/Environment

for a in $USERENV/*; do
        echo $a
        name=`basename $a`
        value="`sed -e 's/%\(.*\)%/\$\1/' <$a`"
        eval export $name=\"$value\"
done

the sed command replaces %VARNAME% with $VARNAME. But this will only work
for the first environment variable in the value. So this probably can be
much improved, but solves the issue for TMP and TEMP. What - an the other
hand - is not needed, because the space in the pathname for these variables
will probably break some shell scripts, so I've put the following lines
after the above code

TEMP=/tmp
TMP=/tmp

But there may be other variables which refer to %USERNAME% or %USERPROFILE%.

> This worked well with the cygwin1.dll 1.3.5, but does not work anymore
with
> 1.3.12. The Visual-Basic-Interpreter cscript.exe that reads the user
> einvironment
> can not be executed when logged in via telnet with cygwin1.dll 1.3.12.

Ok, I don't know any solution for this. I can only say, that it's exactly
the same bug with ssh. But maybe you don't need csript anymore if you try my
suggestion.

Bernd


--
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/



More information about the Cygwin mailing list