From owner-freebsd-questions@FreeBSD.ORG Fri Jun 14 21:23:01 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2B42D323; Fri, 14 Jun 2013 21:23:01 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) by mx1.freebsd.org (Postfix) with ESMTP id EE07019A6; Fri, 14 Jun 2013 21:23:00 +0000 (UTC) Received: from smtp.fisglobal.com ([10.132.206.17]) by ltcfislmsgpa05.fnfis.com (8.14.5/8.14.5) with ESMTP id r5ELMsSh028287 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Fri, 14 Jun 2013 16:22:54 -0500 Received: from LTCFISWMSGMB21.FNFIS.com ([10.132.99.23]) by LTCFISWMSGHT06.FNFIS.com ([10.132.206.17]) with mapi id 14.02.0309.002; Fri, 14 Jun 2013 16:22:54 -0500 From: "Teske, Devin" To: "Mike." Subject: Re: Setting a locale globally Thread-Topic: Setting a locale globally Thread-Index: AQHOaTj39tqEoPw2kUGgHyB5VhugbZk2AyiAgAAI4IA= Date: Fri, 14 Jun 2013 21:22:54 +0000 Message-ID: <13CA24D6AB415D428143D44749F57D7201F82008@ltcfiswmsgmb21> References: <201306141213340281.009F8EE9@smtp.24cl.home> <20130614211207.d2d105b8.freebsd@edvax.de> <201306141554060140.016975D2@smtp.24cl.home> <20130614225107.8a39e8e3.freebsd@edvax.de> In-Reply-To: <20130614225107.8a39e8e3.freebsd@edvax.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.132.253.126] Content-Type: text/plain; charset="Windows-1252" Content-ID: <0245426420D91744802CB5F8F617FB32@fisglobal.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.10.8794, 1.0.431, 0.0.0000 definitions=2013-06-14_07:2013-06-14,2013-06-14,1970-01-01 signatures=0 Cc: Devin Teske , Polytropon , FreeBSD Questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Devin Teske List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2013 21:23:01 -0000 On Jun 14, 2013, at 1:51 PM, Polytropon wrote: > On Fri, 14 Jun 2013 15:54:06 -0400, Mike. wrote: >> On 6/14/2013 at 9:12 PM Polytropon wrote: >>=20 >> |On Fri, 14 Jun 2013 12:13:34 -0400, Mike. wrote: >> |> I would like to set the locale of my 9.1 server to >> |>=20 >> |> LANG=3D"en_US.ISO8859-1" >> |>=20 >> |>=20 >> |> globally, i.e., put the locale entry in one file, and then have the >> |> locale propagate as I go into other shells and run various scripts. >> | >> |You can add this to /etc/csh.cshrc as it will be inherited by >> |all interactive shells (login shells), unless of course they >> |override it with ~/.cshrc: >> | >> | setenv LANG en_US.ISO8859-1 >>=20 >> That works for the login shell, but when I su to another user (e.g., >> root), LANG is no longer in the environment. >=20 > That depends on _how_ you su. For example, if you use su -m, > the environment will not be modified, but the UID 0 is gained. > See "man su" for details. >=20 > But you are correct in terms of what I mentioned: If some > user-configuration changes or unsets $LANG, it will be gone, > and it may even be possible that the setting will not be > transmitted properly to a different shell ("inheriting > environment"), especially if the shell is not the default > login shell, but instead bash or zsh (when the setting is > being made for csh only). >=20 >=20 >=20 >> |It's also possible to add it to /etc/profile and even make an >> |addition to /etc/login.conf's "default" setting: >> | >> | default:\ >> | :setenv=3DLANG=3Den_US.ISO8859-1:... >>=20 >> That works for the login shell, but when I su to another user (e.g., >> root), LANG is no longer in the environment. >=20 > Try su -m.=20 >=20 > Anyway, login.conf should be the better solution compared > to the csh approach illustrated above. It should work > independently from the kind of shell. >=20 Also, you can get the sudo(8) utility to preserve LANG by adding it to the = env_keep list in /usr/local/etc/sudoers For example: Step 1: (as root) visudo Step 2: Find=85 (the default configuration) ## Locale settings # Defaults env_keep +=3D "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET" Step 3: Un-comment the second line (of the two lines shown above). Now whenever you use sudo(8) to execute a command, LANG (and a few others, = like LC_ALL) are preserved. --=20 Devin _____________ The information contained in this message is proprietary and/or confidentia= l. If you are not the intended recipient, please: (i) delete the message an= d all copies; (ii) do not disclose, distribute or use the message in any ma= nner; and (iii) notify the sender immediately. In addition, please be aware= that any message addressed to our domain is subject to archiving and revie= w by persons other than the intended recipient. Thank you.