su under tcsh does not execute the new user's .cshrc

su under tcsh does not execute the new user's .cshrc

Post by Jeff Co » Sat, 26 Feb 1994 03:34:42



I have two users on my Linux box, root and jvc.  Each has a different prompt,
set up in /root/.cshrc and /home/jvc/.cshrc.  If I am logged in as one user
and su to the other, I do not get the new prompt, which makes me think that
the .cshrc of the new user is not executed, as the man page says it should be.
Anyone know the cause of or solution to this problem? ...Jeff
 
 
 

su under tcsh does not execute the new user's .cshrc

Post by J Roz » Mon, 28 Feb 1994 02:29:43


   I have two users on my Linux box, root and jvc. Each has a different prompt,
   set up in /root/.cshrc and /home/jvc/.cshrc.  If I am logged in as one user
   and su to the other, I do not get the new prompt, which makes me think that
   the .cshrc of the new user is not executed, as the man page says it should
   be. Anyone know the cause of or solution to this problem? ...Jeff

jvc% su -
Password:
root#

Your man page is probably wrong. You keep your current environment settings
unless you 'su -'.

jonathan

 
 
 

su under tcsh does not execute the new user's .cshrc

Post by Jeff Co » Wed, 02 Mar 1994 03:30:13


Quote:>I have two users on my Linux box, root and jvc.  Each has a different prompt,
>set up in /root/.cshrc and /home/jvc/.cshrc.  If I am logged in as one user
>and su to the other, I do not get the new prompt, which makes me think that
>the .cshrc of the new user is not executed, as the man page says it should be.
>Anyone know the cause of or solution to this problem? ...Jeff

Thanks to all who responded, but the "-" option is not quite what I am looking
for (I don't want to end up in the home directory of the new user).  I run
tcsh on my Sparc at work, and when I su to another identity, it executes the
.cshrc file of the new user, as specified in the man page for su:

SU(1V)                   USER COMMANDS                     SU(1V)

NAME
     su - super-user, temporarily switch to a new user ID

     ...

     The new shell will not be a login shell, so it will not read
     username's  .login  or  .profile files, but it will read any
     other configuration files for that user (for  instance,  the
     .cshrc  file  for  the  C  shell)  just  as if that user had
     invoked a new shell.

This behavior does not appear to hold for su under tcsh under Linux, or at
least under the version of tcsh that I am using (from SLS 1.0.3), or am I
missing something?  Thanks again...Jeff

 
 
 

1. *AGAIN* CSH - Execute `target' .cshrc with `su'

Yesterday, I posted a request about the execution of .cshrc file of
the target user when executing su:

I received a bunch of responses telling me to execute:
        su - otherUser (i.e. with the `-' option)

This is, to my sense, not satisfactory (i.e. BSD like).  With the `-'
option, su behaves like login, i.e. executes also the .login file;
you are also moved to the otherUser's home directory.  I would prefer
an su which does not execute the .login file and stays where you are ...

I think that the point is that system V su does not change the $USER
environment variable (but only the userid).

Thanks,
Alain
--
Dr. Alain H. Ninane     | Tel : +32-10-47.32.32 - Fax: +32-10-45.21.83

Nuclear Physics Dept.   | Ch. du Cyclotron, 2
B-1348 Louvain-la-Neuve | BELGIUM              

2. Resource metering solaris

3. CSH - Execute `target' .cshrc with `su'

4. Poor man's Ethernet

5. su - c not executing .cshrc

6. secutity FTP question....

7. why 'su' command does not run .profile or .cshrc ?

8. When to take effect

9. Only su can execute netcfg even though ``Allow any user'' is checked

10. Does "su root" execute /.cshrc?

11. su'ing doesn't read /.cshrc

12. .cshrc and 'exec' as the first command to execute.