> When I want to change environment variables for a user I put them in
> .bashrc in there home directory.

Wait!   Don't do this.
Figure out how to get .profile (or .login or both) and .xinitrc
to work the way you need.

> I wanted to change root's environment variables but I did not find a
> .bashrc in /root.  So I created a .bashrc and put in my export commands.
> But when I logon to root it doesn't appear that .bashrc is being executed.
> Where do I change root's environment variables?

Dunno for sure about that.   Could be a security thing.
Check ownership of  1)  the .bashrc file,  2)  root's home dir,
3)  all parent directories of root's home dir.

But about setting environment variables.
Put them in your .profile.   (The equiv for C-Shell variants
is .login,  and there  *are*  ways of having common things
between the two major shell variants.)

I cannot count the number of times when I was a sysadmin that users
would put things into  .zzzzzzrc  rather than in  .profile (or .login).
ALSO PUT THESE into your  .xinitrc,  and make sure that that plays well
with KDE, GNOME,  or whatever your WM of choice.   For that matter,
I have a $HOME/etc/profile that is sourced by either $HOME/.profile
or $HOME/.xinitrc depending on how I sign on (GUI, TELNET, some other).

And when you put things into .profile,
take care to augment some environment variables
while resetting others outright.   A biggie new user mistake
is to explicitly set their PATH.   This causes them more problems
than the sysadmin,  but leads to calls to the Help Desk  (which in
downsizing times winds up being the sysadmin again!).   Users can
easily enough do this

                PATH=/my/preferred/stuff:$PATH

in .profile,
but you don't want that in .bashrc or you might get
"/my/preferred/stuff"  appended sixteen times,  slowing command search
and generally being messy.

-- RMT

Reply via email to