[COLUG] ~/.profile
Rick Troth
rmt at casita.net
Fri Apr 20 18:51:24 EDT 2007
If you sign on via X, then /etc/profile is not normally sourced.
I recommend that you arrange to source it (since you ARE the sysadmin).
A good scheme is to modify both /etc/profile and /etc/X11/xdm/Xsession
to source /usr/local/etc/profile, if it exists.
> So /etc/bash.bashrc is better than /etc/profile,
> since /etc/profile only gets invoked on login shells.
Two problems with using BASH RC files.
First is that they are shell "resource config" files.
They are not "profile" files. The various .xxxshrc files
(in your home dir or in /etc) are good for setting aliases
and non-environmental stuff, things which have to be re-done
every time a shell is spawned. It's a BAD thing to put environmental
settings into RC files. You'll either blow away on-the-fly changes
every time you launch a shell or you'll bloat the environment
every time you launch a shell.
> Of course, this assumes everyone uses bash as their shell.
...
And that would be the second problem with using .bashrc
(or /etc/bash.bashrc) for things like PATH. Don't do it.
I use BASH more than any other shell. But I hate being painted into
a corner and I run a lot of systems that simply do not have BASH,
but they do have some other Bourne compatible shell.
/etc/profile is historically the place to profile your environment.
$HOME/.profile is historically the place for the end user to have
final say about how things will look. X broke this. X is broken
(on this point). (It amazes me that no one has ever fixed XDM!)
> ... If not, it's
> probably best to move back a level to the login sequence,
> and set it there. ...
Yes!! Exactly.
> ... Trouble there is that there are multiple ways of logging in
> and getting a shell (login program, various X display managers,
> remote shell such as ssh, other PAM-using system). /etc/login.defs
> and /etc/security/pam_env.conf are two places to look.
SSH and 'login' (and therefore *getty) are pretty consistent.
It's X that varies. Blame MIT, or make your own adjustment.
It's easy enough to fix it.
If it's just your environment, consider use of $HOME/.xinitrc.
If it's global you need, check out /etc/X11/xdm/Xsession.
Though I have not done so recently, in the past I have modified
/etc/X11/xdm/Xsession (or equiv) to source /usr/local/etc/profile.
Made the same mod to /etc/profile. That way, local profiling was
ALWAYS run no matter how people signed on: TELNET, local, X, anything.
> Doesn't I thought that ~/.profile superceded /etc/profile.
Yes, correct.
Supercede in the sense that it $HOME/.profile can override /etc/profile.
You get the final say about how you want your sign-on environment
profiled. (Your gun, your foot, kind of thing.)
-- R;
More information about the colug432
mailing list