X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SARE_FREE_WEBM_LAPOSTE,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Message-ID: <4BF466D4.5000105@laposte.net> Date: Thu, 20 May 2010 00:31:48 +0200 From: Cyrille Lefevre 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: 1.7.5: sshd environment variables References: <201005010750 DOT 10907 DOT plr DOT vincent AT gmail DOT com> <4BDCCCE7 DOT 7090002 AT cygwin DOT com> <201005020833 DOT 59667 DOT plr DOT vincent AT gmail DOT com> <4BDE1B8B DOT 5070306 AT cygwin DOT com> In-Reply-To: <4BDE1B8B.5070306@cygwin.com> Content-Type: multipart/mixed; boundary="------------040606020009060001020604" X-me-spamlevel: not-spam X-me-spamrating: 33.400002 X-me-spamcause: OK, (-165)(0000)gggruggvucftvghtrhhoucdtuddrvdelvddrudekucetggdotefuucfrrhhofhhilhgvmecuoehnohhnvgeqnecuuegrihhlohhuthemuceftddtnecuucdlqddutddtmdenughimhgrnhgthhgvucdlqddvhedmnehlohhgihhnucdlqddvtddmnehlohhgihhnucdlqddvtddm X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --------------040606020009060001020604 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Le 03/05/2010 02:40, Larry Hall (Cygwin) a =C3=A9crit : > > On 5/2/2010 2:33 AM, Vincent Pelletier wrote: >> Le dimanche 02 mai 2010 02:52:55, Larry Hall (Cygwin) a =C3=A9crit : >>> You can add whatever variables you want and need to a script you can run >>> as part of the login or just after, depending on your needs. >> >> So my question becomes: >> Is it possible to get windows environment vars in a shell obtained via >> ssh >> (to avoid duplicating their definition in my .bashrc) ? Or is there a >> way to >> extend the set of vars sshd lets through to shell (I'm ok with having >> to name >> the variables I need, as long as I don't have to set their value >> manually) ? > > You can get the environment variables using 'env' (or 'set' in 'cmd.exe') > prior to invoking 'ssh'. You can then trim down the list to those that > you want. Putting those in a file that you can invoke shouldn't be hard. around february 19, there was a discussion about to limit ssh=20 environment variables not including some windows ones ! since then, I use the following script to set the missing ones at=20 connection time... you may comment the lines containing SECONDS. it based on Kurt Franke's similar script in the idea. Regards, Cyrille Lefevre --=20 mailto:Cyrille DOT Lefevre-lists AT laposte DOT net --------------040606020009060001020604 Content-Type: text/plain; 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 IHNzaGQgc2VydmVyIHRoaXMgc2NyaXB0IGlzIHVzZWQg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CQllbnZpcm9uW3Zhcl0gPSBoZWFk IHN1YnZhbCB0YWlsCgkJCQl9CgkJCX0KCQl9Cgl9Cglmb3IgKHZhciBpbiBl bnZpcm9uKSB7CgkJaWYgKCEodmFyIGluIG92ZXJyaWRlKSAmJiB2YXIgaW4g RU5WSVJPTikKCQkJY29udGludWUKCQl2YWwgPSBlbnZpcm9uW3Zhcl0KCQlp ZiAoISh2YXIgaW4gbm9jb252ZXJ0KSAmJiAodmFsIH4gLzsvIHx8IHZhbCB+ IC9eLjovKSkgewoJCQlnc3ViKC8oW2EtekEtWl0pOi8sIG1wICIvJiIsIHZh bCkKCQkJZ3N1YigvOi8sIiIsdmFsKQoJCQlnc3ViKC9cXC8sIi8iLHZhbCkK CQkJZ3N1YigvOy8sIjoiLHZhbCkKCQl9CgkJaWYgKHZhciA9PSAiUEFUSCIp IHZhbCA9IHVuaXFwKEVOVklST05bdmFyXSAiOiIgdmFsKQoJCWdzdWIocSwg IlxcInEsIHZhbCkKCQlwcmludCAiZXhwb3J0IiwgdmFyICI9InEgdmFsIHEK CX0KfQonKSIKCWVjaG8gImVsYXBzZWQ6ICQoKCAke1NFQ09ORFM6LSQoZGF0 ZSArJXMpfSAtICRfU0VDT05EU18gKSlzIgoJSUZTPSR7X0lGU199Cgl1bnNl dCBfSUZTXyBfU0VDT05EU18KZmkKCiMgZW9mCg== --------------040606020009060001020604 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 --------------040606020009060001020604--