SUMMARY: Common login initialization for csh and tcsh?

From: Jim Reisert (jjr@databook.com)
Date: Thu Apr 17 1997 - 14:25:43 CDT


The concensus is that the /etc/.login file is the one to use, although
many use a common file that everyone must source. I found that on
SunOS (4.1) that /etc/csh.cshrc was a good choice, and for Solaris,
/etc/.login. Particularly useful was Karl Vogel's response to use the
'strings' command to see what is generally acceptable.

Thanks to everyone who replied:

        rtrzaska@uk.mdis.com (Ray Trzaska)
        Erwin Fritz <efritz@glja.com>
        David Perel <davidp@jsbach.njit.edu>
        boss@netcom.com (Todd Boss)
        foster@bial1.ucsd.edu
        "Rick von Richter" <rickv@mwh.com>
        "Karl E. Vogel" <vogelke@c17mis.region2.wpafb.af.mil>
        "Christopher L. Barnard" <cbar44@tsg.cbot.com>
        Ruth H Woods <rwoods@Census.GOV>
        alan@ece.missouri.edu (Alan Fox)
        hxktb0@svho1nfs_1.supervalu.com (Kris Briscoe)
        Richard Skelton <rich@brake.demon.co.uk>
        "Mark `Hex' Hershberger" <mah@eecs.tulane.edu>
        Casper Dik <casper@holland.Sun.COM>
        jasonn@nabaus.com.au (Jason Noorman)
        Glenn Satchell - Uniq Professional Services <Glenn.Satchell@uniq.com.au>
        "Matthew Stier" <mstier@hotmail.com>
        Kevin.Sheehan@uniq.com.au (Kevin Sheehan {Consulting Poster Child})
        Stefan <s.voss@terradata.de>
        Jens Fischer <jefi@kat.ina.de>
        chaggard@fedex.com (Chistopher Haggard)

All responses are attached below.

- Jim

To: sun-managers@ra.mcs.anl.gov
Subject: Common login initialization for csh and tcsh?
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Wed, 09 Apr 1997 11:29:51 -0400
From: Jim Reisert <jjr@databook.com>
Reply-to: Jim Reisert <jjr@databook.com>
Followup-to: Jim Reisert <jjr@databook.com>
Precedence: bulk
content-length: 497

I notice that on Solaris, /etc/profile is supposed to be called when the
user's shell is sh.

I want to set up a common login procedure (to get paths and common environment
variables set up properly) for my users who are mostly using csh and tcsh.

What's the best way to go about this, besides copying my (working) .cshrc file
into their home directories?

Thanks - Jim

-- 
Jim Reisert <jjr@databook.com>		SMC Massachusetts, Danvers, MA
http://www.tiac.net/users/ad1c/		http://www.smc.com/

Date: Wed, 9 Apr 1997 17:47:24 +0100 From: rtrzaska@uk.mdis.com (Ray Trzaska) Message-Id: <199704091647.RAA04076@toad.uk.mdis.com> To: jjr@databook.com Subject: Re: Common login initialization for csh and tcsh? Mime-Version: 1.0

for csh the common profile is /etc/.login for tcsh ? I don't know, I haven't seen the code for ksh it is back to /etc/profile

ray

Date: Wed, 09 Apr 1997 11:06:55 -0600 From: Erwin Fritz <efritz@glja.com> Reply-To: efritz@glja.com Organization: Gilbert Laustsen Jung Associates Ltd. X-Mailer: Mozilla 3.0 (WinNT; I) MIME-Version: 1.0 To: Jim Reisert <jjr@databook.com> Subject: Re: Common login initialization for csh and tcsh?

I have a filesystem, /common, which is available on any machine on my network. In it are two files, cshrc.standard and login.standard.

The first line of each user's .cshrc and .login are calls to 'source' the standard ones. That way users can put their own code in after this call but their environments won't be messed up.

Date: Wed, 9 Apr 1997 13:08:01 -0400 (EDT) From: David Perel <davidp@jsbach.njit.edu> Message-Id: <199704091708.NAA24844@jsbach.njit.edu> To: jjr@databook.com Subject: Re: Common login initialization for csh and tcsh? content-length: 941

You could have the users' inititialization files be of the form:

(e.g, for the users' .cshrc):

# # standard .cshrc # source /path_to_system_files/std-cshrc

Individual users can then add to this .cshrc as needed.

-david

From: boss@netcom.com (Todd Boss) Message-Id: <199704091708.KAA19420@netcom.netcom.com> Subject: Re: Common login initialization for csh and tcsh? To: jjr@databook.com Date: Wed, 9 Apr 1997 10:08:32 -0700 (PDT) In-Reply-To: <199704091529.LAA01490@minuteman.databook.com> from "Jim Reisert" at Apr 9, 97 11:29:51 am

a good question, as csh and tcsh dont' make use of any centralized configuration files as the sh and ksh do. Heres what we did:

in /etc have these files: these contain your system wide variables: paths, ld_library_paths, etc /etc/cshrc.main /etc/login.main /etc/logout.main then in something like /etc/skel have cshrc.initial login.initial logout.initial mknewuser.sh: a script which can do many things, but at the minimum takes the three .initial files and copies them to $home/.cshrc, $home/.login, and $home/.logout of the new user.

All three .initial files are basically like this: i'd put in an explaination to the users of what you're doing, then have code like this:

# To change something which is NOT a system default, # put your *after* these lines.

# REPLACE THIS LINE WITH CHANGES

# To change something which is NOT a system default, # put your *before* these lines.

# System default values are set by the following line: source /etc/login.main # DO NOT DELETE THIS LINE, PLEASE

# To change a system default, put your # commands *after* these lines. Be careful!

# REPLACE THIS LINE WITH CHANGES

# To change a system default, put your # commands *before* these lines.

--- voila you're in business. Initially you'll probably have to write another script that reads everyone's personal .cshrc and .login (not too many have .logouts) and puts their customizations in the correct place in your new scheme. Hopefully you don't have too many users where this is necessary.

boss --- __ _ / /_ Todd Boss, Consultant Virtualogic Incorporated | |/ / / Unix Sysadmin/Sybase DBA 6707 Democracy Blvd, Suite 202 | / /__ tboss@virtualogic.com Bethesda, Maryland 20817 |__/____/ boss@netcom.com (301) 571-5100 x173

From: foster@bial1.ucsd.edu Date: Wed, 9 Apr 1997 10:09:21 -0700 Message-Id: <199704091709.KAA17687@bial1.ucsd.edu> To: jjr@databook.com Subject: Re: Common login initialization for csh and tcsh?

On our systems I have created a "/.cshrc_common" file that contains environment parameters that should be common to everyone on the system. Then, at the beginning of each user's .cshrc file I include the line

source /.cshrc_common

This will make your life infinitely easier, as you will only have to edit this one file when making changes.

Dave Foster foster@bial1.ucsd.edu

Date: Wed, 9 Apr 1997 10:26:31 -0700 From: "Rick von Richter" <rickv@mwh.com> To: jjr@databook.com Subject: Re: Common login initialization for csh and tcsh?

There are probably a milion ways to do this but I'll give you what we do here.

Create a directory /usr/local/env

In it put environment files you would like to have sourced in when a user logs in. Some common ones we use are the path.env.ksh & path.env.csh. For korn & cshell users. Then link the users' $HOME/.profile & $HOME/.cshrc to a common ..profile and .cshrc and in the common files put lines in that source in your env files from /usr/local/env.

Here is an example of a korn shell users' $HOME/.profile I am using /export/local/env to store my environment files.

#!/bin/ksh # NOTE DO NOT ALTER THIS FILE, # MAKE YOUR CHANGES IN $HOME/.env !!!! # # Generic .profile for mis group # # Modified: 960825 by Rick V # 1) Added tests for CDE logins. Testing for $DT (CDE login) # 2) Added LOCALENV environment variable # Modified: # export LOCALENV=/export/local # Test for CDE login. ($DT set = CDE login) if [ ! "$DT" ]; then trap "" 2 3 case ${TERM} in vt100) [ -t 1 ] && stty -tabs ;; dbavt100) TERM=vt100 export TERM exec $LOCALENV/oracle/dba ;; esac fi # Source in system environment files [ -r $LOCALENV/env/path.env ] && . $LOCALENV/env/path.env [ -r $LOCALENV/bin/termtest.sh ] && . $LOCALENV/bin/termtest.sh [ -r $LOCALENV/env/startup.env ] && . $LOCALENV/env/startup.env [ -r $LOCALENV/env/vi.env ] && . $LOCALENV/env/vi.env [ -r $LOCALENV/env/oracle.set.env ] && . $LOCALENV/env/oracle.set.env [ -r $LOCALENV/env/mis.env ] && . $LOCALENV/env/mis.env [ -r $LOCALENV/env/fax.env ] && . $LOCALENV/env/fax.env [ -r $LOCALENV/env/sqr.env ] && . $LOCALENV/env/sqr.env # End sourcing

# Source in users personal environment. [ -r $HOME/.env ] && . $HOME/.env # End sourcing

Hope this helps.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Rick von Richter | Phone: 619-552-6222 Systems/Network Admin | Fax: 619-552-6221 Maintenance Warehouse | Email: rickv@mwh.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Science is true. Don't be misled by facts. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Date: Wed, 9 Apr 1997 13:32:50 -0400 (EDT) Message-Id: <199704091732.NAA14461@ss118.region2.wpafb.af.mil> From: "Karl E. Vogel" <vogelke@c17mis.region2.wpafb.af.mil> To: jjr@databook.com Subject: Re: Common login initialization for csh and tcsh? Organization: Sumaria Systems Inc.

If you do "strings -a /path/to/tcsh | grep '^/'", you should see /etc/.login, /etc/.logout, and /etc/.cshrc listed. If I remember correctly, those files are used first, and then the user's personal files.

I'm not sure if csh is quite that smart.

-- Karl Vogel vogelke@c17.wpafb.af.mil ASC/YCOA, Wright-Patterson AFB, OH 45433 937-255-3688

To: Jim Reisert <jjr@databook.com> Subject: Re: Common login initialization for csh and tcsh? Date: Wed, 9 Apr 1997 12:32:54 -0500 From: "Christopher L. Barnard" <cbar44@tsg.cbot.com>

Its /etc/.login.

+-----------------------------------------------------------------------+ | Christopher L. Barnard O When I was a boy I was told that | | cbarnard@tsg.cbot.com / \ anybody could become president. | | (312) 347-4901 O---O Now I'm beginning to believe it. | | http://www.cs.uchicago.edu/~cbarnard --Clarence Darrow | +----------PGP public key available via finger or PGP keyserver---------+

Date: Wed, 9 Apr 1997 13:57:33 -0400 (EDT) From: Ruth H Woods <rwoods@Census.GOV> To: Jim Reisert <jjr@databook.com> Subject: Re: Common login initialization for csh and tcsh?

The /etc/.login file works for csh, don't know about tcsh.

Date: Wed, 9 Apr 1997 13:02:30 -0500 From: alan@ece.missouri.edu (Alan Fox) Message-Id: <199704091802.NAA29688@sun4.umc_ece> To: jjr@databook.com Subject: Common Login

I use /etc/.login as both tcsh and csh read this system wide.

Alan Fox University of Missouri

Date: Wed, 9 Apr 1997 13:10:04 -0500 From: hxktb0@svho1nfs_1.supervalu.com (Kris Briscoe) To: jjr@databook.com Subject: Re: Common login initialization for csh and tcsh?

/etc/.login

try this

Kris

Date: Wed, 9 Apr 1997 19:12:03 +0100 From: Richard Skelton <rich@brake.demon.co.uk> To: jjr@databook.com Subject: Re: Common login initialization for csh and tcsh?

Hi Jim, Please send summary. Cheers Richard. = Richard Skelton | e-mail : Richard.Skelton@brake.demon.co.uk WWW : http://www.brake.demon.co.uk/

Date: Wed, 9 Apr 1997 14:50:20 -0500 (CDT) From: "Mark `Hex' Hershberger" <mah@eecs.tulane.edu> To: Jim Reisert <jjr@databook.com> Subject: Re: Common login initialization for csh and tcsh?

/etc/login or /etc/cshrc. tcsh can be compiled to point to any file such as /usr/local/etc/tcsh.login

_o ) mah@eecs.tulane.edu Mark `Hex' Hershberger `\< New Orleans, LA ( (*)/(*) c[] hex@eecs.tulane.edu

[I]f we believers unnaturally shove America's perversions into the shadows, some might wrongly conclude that our land was suddenly righteous. What need, then, would we have for God? -- "Antiseptic America," Charles T. Evans

To: Jim Reisert <jjr@databook.com> Subject: Re: Common login initialization for csh and tcsh? Date: Wed, 09 Apr 1997 21:52:01 +0200 From: Casper Dik <casper@holland.Sun.COM> content-length: 391

/etc/.login

Casper

Subject: Re: Common login initialization for csh and tcsh? To: jjr@databook.com Date: Wed, 9 Apr 1997 21:27:59 +0100 (BST) In-Reply-To: <199704091529.LAA01490@minuteman.databook.com> from "Jim Reisert" at Apr 9, 97 11:29:51 am

In the .login file, "source /etc/skel/login"

rgds Stephen

Date: Thu, 10 Apr 1997 07:14:33 +1000 From: jasonn@nabaus.com.au (Jason Noorman) To: jjr@databook.com Subject: Re: Common login initialization for csh and tcsh?

Generally I give every developer/user/trader there own .cshrc file and the second line sources the system.cshrc. The allows every one to be differant and still have all the system standard bits included.

Jason

+--------------------------------------------------------------------------+ | ,-_/\ Jason D. Noorman Email: jasonn@nabaus.com.au | | / \ Snr Unix Systems Consultant. Group Treasury Technology. | | \_,-._/ National Australia Bank Limited. | | v 14/500 Bourke Street. Melbourne. Victoria. Australia. 3000. | | Phone: +61 3 9641 4027 Facsimile: +61 3 9641 4928 | +--------------------------------------------------------------------------+

Date: Thu, 10 Apr 1997 07:58:21 +1000 (EST) From: Glenn Satchell - Uniq Professional Services <Glenn.Satchell@uniq.com.au> To: jjr@databook.com Subject: Re: Common login initialization for csh and tcsh?

/bin/csh will use /etc/.login if it exists in Solaris 2. Don't know about tcsh, but since you have the source it would not be too difficult to add that in. Otherwise everyone's .login (and ..cshrc) can just have an entry to source your master copies located in a publically readable directory.

regards, -- Glenn Satchell glenn@uniq.com.au www.uniq.com.au | Windows: Uniq Professional Services Pty Ltd ACN 056 279 335 | PO Box 70, Paddington, NSW 2021, (Sydney) Australia | Just another pane Phone 02 9380 6360 Pager 016 287 000 Fax 02 9380 6416 | in the glass... VISIT OUR WEB SITE http://www.uniq.com.au

From: "Matthew Stier" <mstier@hotmail.com> To: jjr@databook.com Subject: Re: Common login initialization for csh and tcsh? Content-Type: text/plain Date: Wed, 09 Apr 1997 15:50:00 PDT

1) Invest some time into 'modules'. (ftp://ftp.eng.auburn.edu/pub/Modules/) It will provide your users with a shell independent configuration mechanism.

2) /bin/csh reads /etc/.login

3) tcsh, you will always have the source for, and it defines a variable (${tcsh}) to differenciate itself from csh.

-- Matthew Stier mstier@hotmail.com

From: Kevin.Sheehan@uniq.com.au (Kevin Sheehan {Consulting Poster Child}) Date: Thu, 10 Apr 1997 08:40:13 EST To: Jim Reisert <jjr@databook.com> Subject: Re: Common login initialization for csh and tcsh?

man csh...

....where you find about /etc/.login

On another note, I would move your users to ksh or bash or one of the other shells. Command line editting comes with, and they get used to the 'real' shells, which is much better for scripting.

l & h, kev

Date: Thu, 10 Apr 1997 08:58:04 +0200 (MET DST) From: Stefan <s.voss@terradata.de> To: jjr@databook.com Subject: Re: Common login initialization for csh and tcsh?

Hi,

what i have done, is very simple:

i have created a file /usr/local/bin/global.cshrc which contains all the things that all the users should have set. It is simply sourced in ~/.cshrc. This gives you the chance, to add/change certain things locally in ~/.cshrc just after sourcing the global file. The advantage is, that this works under every operating system and not only under operating systems which know /etc/profile or something similar ( --> heterogenous environment )...

Regards,

Stefan

,,, (o o) --------------------------------o0Oo-(_)-oO0o---------------------------------

Stefan Voss Phone: # 49 (0) 5139-9908-51 Software & System Support Fax: # 49 (0) 5139-9908-10 TerraData Geophysical Services GmbH e-mail: s.voss@terradata.de Ehlbeck 15 a D - 30938 Burgwedel

From: Jens Fischer <jefi@kat.ina.de> Date: Thu, 10 Apr 1997 14:08:41 +0200 To: jjr@databook.com Subject: Re: Common login initialization for csh and tcsh?

Hi Jim,

/etc/.login may be what you are looking for, but this file is only used for login shells.

Hope that helps

Kind Regards - Jens Fischer

I User : Jens Fischer Department : DV-Anwendungsentwicklung Technik I N A Company : INA Werk Schaeffler KG Address Industriestrasse 1-3 A D 91074 - Herzogenaurach Phone : (+49)9132-823262 FAX : (+49)9132-824953 e-mail : fischjns@kat.ina.de

From: chaggard@fedex.com (Chistopher Haggard) Date: Thursday, 10 April 1997 9:23am CT To: jjr@databook.com Subject: Common login initialization for

Solaris does it with /etc/.login, modify that file. Each user can also have a ..login (and .logout) and .cshrc (or .tcshrc) (both actually) And also, /etc/profile is read by users of ksh, sh, and sbin/sh (root).



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:50 CDT