X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 11 Aug 2010 14:33:08 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Missing APPDATA var in env of ssh sessions? Message-ID: <20100811123308.GG14202@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <4C6225D9 DOT 2060604 AT cwilson DOT fastmail DOT fm> <20100811080107 DOT GA26152 AT calimero DOT vinschen DOT de> <4C6292D7 DOT 30002 AT cwilson DOT fastmail DOT fm> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4C6292D7.30002@cwilson.fastmail.fm> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On Aug 11 08:08, Charles Wilson wrote: > On 8/11/2010 4:01 AM, Corinna Vinschen wrote: > > On Aug 11 00:23, Charles Wilson wrote: > >> Can ssh (or is it cygwin1.dll?) ensure that the user's APPDATA variable > >> is populated, since it appears to be a pretty important var for Windows > >> Vista+? > > > > In `man sshd' see the LOGIN PROCESS and SSHRC sections, as well as the > > AUTHORIZED_KEYS FILE FORMAT section. > > > > In `man sshd_config' see the descriptions for AcceptEnv and > > PermitUserEnvironment. > > Thanks. I was able to get the desired behavior by; > > 1) adding 'PermitUserEnvironment yes' to /etc/sshd_config > 2) restarting sshd, and > 3) Adding a new file, ~/.ssh/environment, with the following content > APPDATA=C:\Users\me\AppData\Roaming j > Then, logging in via ssh, the new environment has the correct value, and > "mingw-get" doesn't litter my CWD with %APPDATA% directories. > > I was thinking this facility might be made the default via updates to > ssh-user-config and ssh-host-config, but 'PermitUserEnvironment' carries > a pretty severe warning in 'man sshd_config', so probably not. > > Those affected will probably find this thread, and the solution, for > themselves. Indeed, I rather stick to the default options as given in the upstream release. Btw., what you can do as well is to set APPDATA in a shell profile, for instance in /etc/profile.d: _sid=$(grep "^$USER:" /etc/passwd | sed -e 's/[^:]*:[^:]*:[^:]*:[^:]*:[^:]*,\(S-1-5-[^:]*\):.*/\1/') _prof=$(cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows\ NT/CurrentVersion/ProfileList/${_sid}/ProfileImagePath) export APPDATA="${_prof}\\AppData\\Roaming" unset sid unset prof Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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