[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ~/.profile and ~/.bash_profile aren't executed on login

From: Bob Proulx
Subject: Re: ~/.profile and ~/.bash_profile aren't executed on login
Date: Sat, 9 Dec 2017 15:59:22 -0700
User-agent: Mutt/1.9.1 (2017-09-22)

Yuri wrote:
> None of these files are executed when bash is a user's default shell on
> FreeBSD.
> No special options were selected. Despite shell.c saying that they should be
> executed they just aren't.

How is the user logging in?  Are they logging in with 'ssh' over the
network?  Or are they logging in through an "xdm" X Display Manager
login from a graphical login display?

If from 'ssh' then that is the standard Unix login path with no surprises.

If from a graphical login display, which I think most likely is the
case, then it all depends upon how the shell is launched from that
point.  The shell looks at its own name, or the -l or --login option,
to determine if it is a login shell or not.  If it is a login shell
then it sources the login files.  If not then it does not and sources
the .bashrc environment file all as documented in the manual.

The most typical problem IMNHO is that graphical login managers should
set things up for sourcing the login files but by default do not.  I
am not familiar with BSD.  I am only familiar with the GNU/Linux
distributions and they often fail to set things up properly to source
the login files correctly.  That is not a bug in bash but is a bug in
the graphical login environment.

This is also a case of "bike shedding" because this is something that
everyone seems to have an opinion on about how this should be done.
And the opinions conflict with each other.  And therefore it will
likely never get resolved where it works automatically without
individual customization to make it work.

If your environment has the capability for $HOME/.xsessionrc then that
is usually the simplest suggestion to place login environment setting
actions there.  However note that it is a #!/bin/sh script and not a
bash script and therefore should use only POSIX portable shell syntax
in that file.  And also note that there are many other configurations
possible too.  I personally do something quite different for example.

Beyond this any other suggestions would require a *long* discussion of
how each graphical login environment works.  Therefore more
information about your environment would be needed.

> Is this a bug?

I feel confident that it is a consequence of how the shell is started.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]