delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/02/12/17:21:35

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SARE_FREE_WEBM_LAPOSTE,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4F383B80.5080600@laposte.net>
Date: Sun, 12 Feb 2012 23:21:52 +0100
From: Cyrille Lefevre <cyrille DOT lefevre-lists AT laposte DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.3) Gecko/20070326 Thunderbird/2.0.0.0 Mnenhy/0.7.5.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: PROGRAMFILES variable is not set during openssh session
References: <1329064411 DOT 16602 DOT 15 DOT camel AT arcfi-laptop>
In-Reply-To: <1329064411.16602.15.camel@arcfi-laptop>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--------------060807070306050109090600
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Le 12/02/2012 17:33, ArcFi a =C3=A9crit :
> PROGRAMFILES variable is not set during openssh session.
> This is very important for remote administrative tasks.
>
> admin AT srv06 ~
> $ echo $COMPUTERNAME,$PROGRAMFILES,$USERPROFILE,$SYSTEMDRIVE
> SRV06,C:\Program Files,C:\Documents and Settings\admin,C:
>
> admin AT srv06 ~
> $ ssh localhost 'echo $COMPUTERNAME,$PROGRAMFILES,$USERPROFILE,
> $SYSTEMDRIVE'
> admin AT localhost's password:
> SRV06,,,C:
>

around february 19 2011, there was a discussion about to limit ssh=20
environment variables not including some windows ones !

since then, I use the attached script in /etc/profile.d to set the=20
missing ones at connection time...

you may comment the lines containing SECONDS.

it's based on Kurt Franke's similar script in the idea.

PS : Corinna, maybe this may be made a FAQ ?

Cyrille Lefevre
--=20
mailto:Cyrille DOT Lefevre-lists AT laposte DOT net

--------------060807070306050109090600
Content-Type: application/x-shellscript;
 name="ssh-session-env.sh"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="ssh-session-env.sh"

IyEvYmluL3NoCiMKIyBzc2gtc2Vzc2lvbi1lbnYuc2ggLSBzY3JpcHQgZm9y
IGluc3RhbGxhdGlvbiBpbiAvZXRjL3Byb2ZpbGUuZAojCiMgYmVjYXVzZSBp
biBzZXNzaW9ucyBzdGFydGVkIGZyb20gc3NoZCB0aGUgd2luZG93cyBzeXN0
ZW0gZW52aXJvbm1lbnQKIyB2YXJpYWJsZXMgaW4gZ2VuZXJhbCBhcmUgbm90
IHNldCBleGNlcHQgZm9yIHNvbWUgd2hpY2ggYXJlIHBvc3NpYmxlCiMgc3Bl
Y2lhbCBoYW5kbGVkIChsaWtlIFBBVEgsIGV0Yy4pIGFuZCB0aGUgd2luZG93
cyB1c2VyIGVudmlyb25tZW50CiMgdmFyaWFibGVzIGFyZSBub3Qgc2V0IGZy
b20gdGhlIGFjdHVhbCB1c2VyIGJ1dCBmcm9tIHRoZSB1c2VyIG9mIHRoZQoj
IHNzaGQgc2VydmVyIHRoaXMgc2NyaXB0IGlzIHVzZWQgdG8gYnVpbGQgdGhp
cyBlbnZpcm9ubWVudCBzZXR0aW5ncyBpbgojIHNoZWxscyB3aXRoIGJvdXJu
aXNoIHN5bnRheCB3aGljaCB1c2VzIC9ldGMvcHJvZmlsZSBmb3IgaW5pdGlh
bGl6YXRpb24uCiMKIyBhdXRob3JzOiBLdXJ0IEZyYW5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RU5WSVJPTikKCQkJY29udGludWUKCQl2YWwgPSBlbnZpcm9uW3Zhcl0KCQlp
ZiAoISh2YXIgaW4gbm9jb252ZXJ0KSAmJiAodmFsIH4gLzsvIHx8IHZhbCB+
IC9eIj8uOi8pKSB7CgkJCWdzdWIoLyhbYS16QS1aXSk6LywgbXAgIi8mIiwg
dmFsKQoJCQlnc3ViKC9cXC8sIi8iLHZhbCkKCQkJZ3N1YigvWzoiXXxcLyQv
LCIiLHZhbCkKCQkJZ3N1YigvXC8/Oy8sIjoiLHZhbCkKCQl9CgkJaWYgKHZh
ciA9PSAiUEFUSCIpIHsKCQkJZ3N1YigvIihbYS16QS1aXSk6LywgbXAgIi8m
IiwgRU5WSVJPTlt2YXJdKQoJCQlnc3ViKC8ifFwvJC8sIiIsRU5WSVJPTlt2
YXJdKQoJCQlnc3ViKC9cLzovLCI6IixFTlZJUk9OW3Zhcl0pCgkJCXZhbCA9
IHVuaXFwKEVOVklST05bdmFyXSAiOiIgdmFsKQoJCX0KCQlnc3ViKHEsICJc
XCJxLCB2YWwpCgkJcHJpbnQgImV4cG9ydCIsIHZhciAiPSJxIHZhbCBxCgl9
Cn0KJykiCgllY2hvICJlbGFwc2VkOiAkKCggJHtTRUNPTkRTOi0kKGRhdGUg
KyVzKX0gLSAkX1NFQ09ORFNfICkpcyIKCUlGUz0ke19JRlNffQoJdW5zZXQg
X0lGU18gX1NFQ09ORFNfCmZpCgojIGVvZgo=


--------------060807070306050109090600
Content-Type: text/plain; charset=us-ascii

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019