[comp.unix.internals] System-wide .login?

SYKLB%NASAGISS.BITNET@cunyvm.cuny.edu ( Ken Bell) (11/03/90)

On Fri, 2 Nov 90 19:16:00 EST Bill Wine, system manager, 437-7226 said:
>When a user logs in to the C-shell, the files .cshrc and .login are executed.
>Is there a way to have a file (other than login) run when each user logs in?
>In other words, is there a Unix file equivalent to sylogin.com in the VMS
>world?

How about --  'ln -s .login some_other_file' ?
Or, simply have .login do nothing else but exec your preferred file?

(What's "sylogin.com" and why is it better than ".login" ?!)
Ken Bell (SYKLB@NASAGISS * SYKLB@NASAGISS.GISS.NASA.GOV * 212-678-5545)
Acknowledge-To: <SYKLB@NASAGISS>

prc@erbe.se (Robert Claeson) (11/04/90)

In a recent article SYKLB%NASAGISS.BITNET@cunyvm.cuny.edu ( Ken Bell) writes:

>On Fri, 2 Nov 90 19:16:00 EST Bill Wine, system manager, 437-7226 said:
>>When a user logs in to the C-shell, the files .cshrc and .login are executed.
>>Is there a way to have a file (other than login) run when each user logs in?
>>In other words, is there a Unix file equivalent to sylogin.com in the VMS
>>world?

>How about --  'ln -s .login some_other_file' ?
>Or, simply have .login do nothing else but exec your preferred file?

>(What's "sylogin.com" and why is it better than ".login" ?!)

Syslogin.com is a system-wide login file that gets executed before
the user's own login file is run. Its purpose is for the system
admins to be able to set up reasonable defaults for applications,
establish commands, logicals and the like (ie, search paths and
environment variables in UNIX lingo). Thus, a user need only 
edit his or her own login file if he or she wishes to change a default
or logical defined in syslogin.com, or to add more private commands
and logicals.

Csh doesn't have anything similar, but Bourne and Korn shell do,
at least under System V. The file /etc/profile serves the same
purpose as syslogin.com.

-- 
Robert Claeson                  |Reasonable mailers: rclaeson@erbe.se
ERBE DATA AB                    |      Dumb mailers: rclaeson%erbe.se@sunet.se
                                |  Perverse mailers: rclaeson%erbe.se@encore.com
These opinions reflect my personal views and not those of my employer.

guy@auspex.auspex.com (Guy Harris) (11/04/90)

(This is *NOT* a "wizards" or "internals" question, so followups are
being redirected to "comp.unix.shell".  There is, as far as I know, no
mailing list gatewayed there; mail followups should probably be sent to
"info-unix", which I think still goes to "comp.unix.questions".)

>(What's "sylogin.com" and why is it better than ".login" ?!)

Well, one might be able to infer what it is from the subject line.

When a login C shell starts up, it sources ".cshrc" from the user's home
directory, and then ".login" from the user's home directory.  Some
versions of the C shell *also* will source a file from some system
directory, e.g. "/etc/csh.login" or whatever.

This is similar to what more recent versions of the Bourne and Korn
shell do; they source the ".profile" file from the user's home
directory, but also source "/etc/profile" as well.

The problem with

>How about --  'ln -s .login some_other_file' ?
>Or, simply have .login do nothing else but exec your preferred file?

is that the "other file" would be global, so nobody would be able to do
any customization of their environment.

The answer to the original question

>>In other words, is there a Unix file equivalent to sylogin.com in the VMS
>>world?

is "no", for a couple of reasons:

1) not everybody in UNIX uses the same shell; some use Bourne-compatible
   shells (Bourne shell, "ksh", "bash", etc.), while others use the C
   shell.  As such, there couldn't be *one* file equivalent to
   "sylogin.com" on a UNIX system that has the C shell.

2) not all UNIX shells directly support the notion of a global file of
   that sort.  Older versions of the Bourne shell don't, and most
   versions of the C shell don't (some do, such as the S5R4 C shell and,
   I think, the HP-UX C shell, and probably some others).

If not all shells support that notion, one thing you can do is have
everybody's ".login" or ".profile" file source the global file, although
those users may be allowed to edit or replace their ".login" or
".profile" file and have it not do so, so you may not be able to
guarantee that the global file will be executed. 

PHILIP@ucc.uwindsor.ca (Philip Smith, Systems Programmer) (11/05/90)

Bill,

Some versions based on 4.3BSD may use the following files:

  /etc/csh.cshrc
  /etc/csh.login
  /etc/csh.logout


Philip Smith
Systems Programmer
University of Windsor

ijk@cbnewsh.att.com (ihor.j.kinal) (11/07/90)

In article <1990Nov3.202245.3466@erbe.se>, prc@erbe.se (Robert Claeson) writes:
> Csh doesn't have anything similar, but Bourne and Korn shell do,
> at least under System V. The file /etc/profile serves the same
> purpose as syslogin.com.
> 

QUESTION: is /etc/profile really executed upon login under the ksh,
	assuming the user has ksh  as the login shell??  If I want
	to define a GLOBAL alias for everyone can I do it in /etc/profile?
	[To answer my own question, is I don't think so].

The only other way I can think of doing this is to  define ENV to be 
	read-only, and set it to a file containing the alias in question.
	This is a rather crude method, and unacceptable if I want
	users to have additional ENV capabilities.
	
So why doesn't ksh have a global ENV file??

#include standard disclaimers: plus `they' don't give me root, so I
can't really play with setting /etc/profile :-)

Ihor Kinal
att!cbnewsh!ijk