4bsd .login and .cshrc

alan denney aland at infmx.UUCP
Sat Mar 26 14:57:51 AEST 1988


Sorry if this went out before, I had an error flash by in the middle of
the post attempt...

In article <27717 at linus.UUCP>, jfjr at mitre-bedford.ARPA (Jerome Freedman) writes:
> 
>   Excuse my ignorance but this is a chance to nibble away at
> it. Could someone explain to me, for 4.2 especially the Sun
> version exactly how and in what order the .login and .cshrc
> files are read (executed?). How are these files handled when
> you initiate Suntools? How are they handled if you "su" to
> another account? How are they handled in an rlogin? How
> about them Celtics?
> 
>  Thank you
> 
> Jerry Freedman, Jr      "Love is staying up all night 
> jfjr at mitre-bedford.arpa   with a sick child,
> (617)271-4563            or a healthy adult"

You may have been "RTFM"d for this, but I have seen a lot of people get
confused about this, so don't feel too bad.  (Public note: the man
pages for "su" and "csh" appear to disagree).

The .cshrc file is read and executed (if possible) upon every csh
fireup, INCLUDING the login shell.  The .login is read and executed 
AFTER the .cshrc.  If either file is not owned by the person logging
in, it is not executed.  (Of course, root can use /usr/5bin/chown to
change ownership for a new user.)

Of course, things get confusing if the user does something silly,
like having a "source .login" command within the .cshrc (which I
have seen more than a few times ;-]).


> How are these files handled when you initiate Suntools? 

Sorry, over my lowly head..


> How are they handled if you "su" to another account? 

When using "su": if the default shell for the user su'd to is csh,
that user's .cshrc is executed.  If "su - usernm" is used, the .login
is also executed (again, AFTER the .cshrc).  The man page for "su"
states (quoted without permission, please forgive me, Sun):

| SYNOPSIS
|      su [ - ] [ username ] [ -c command ] [ -f ]
|
| OPTIONS
|      -    The - flag performs a  complete  login.   That  is,  it
|           moves to the home directory, reads the .login file, and
|           reads the .cshrc file for the new user-ID to  configure
|           the new shell.
| 
| Sun Release 3.4   Last change: 17 February 1986                 1

This is a good source of confusion; the .cshrc is executed FIRST.
I would interpret this passage to claim that the .login goes first.
(Any Sun documentation people out there?)


> How are they handled in an rlogin?

Just the same as a direct login.  I believe that "rsh" invokes the
.cshrc file (only) of the user on the remote machine.

> How about them Celtics?

How about them Giants!

--
 Alan S. Denney                | {pyramid|uunet}!infmx!aland
 Informix Software, Inc.       | CAUTION: This terminal makes wide right turns!

 Disclaimer: These opinions are mine alone.  If I am caught or killed,
             the secretary will disavow any knowledge of my actions.



More information about the Comp.unix.questions mailing list