Bug 21804 - bash2 doesn't read .bash_profile and friends under certain conditions
Summary: bash2 doesn't read .bash_profile and friends under certain conditions
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: bash   
(Show other bugs)
Version: 6.2
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2000-12-06 15:46 UTC by Need Real Name
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-12-15 22:17:29 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Need Real Name 2000-12-06 15:46:59 UTC
bash2 doesn't  read .bash_profile and friends when invoking bash2 by a
command such as "su - postgres -c /home/postgres <some_command>.
It works properly if "su - postgres" is used but when the -c option is
bash2 fails to read any of the initialization files.

As a side note bash also has broken behavior when reading the startup
Try adding some echo statements to .bash_profile, .bashrc, and .profile
and watch what happens when using "su - <user>".  It's fascinating.

Comment 1 Phil Knirsch 2002-07-23 09:29:55 UTC
Just tested it, on 7.3 at least it works as expected, that is, i added an   echo
"FOOBAR was here!" to a test accounts .bashrc and that was printed with a

[root@hamburg root]# su - test -c "/bin/ls /tmp/"
fonts.alias.kJoSlU  krb5cc_2903_kARIoT  mcop-root
kde-pknirsch        ksocket-pknirsch    plugtmp
kde-root            mcop-pknirsch       ssh-XXUBayLZ

Keep in mind though that if you use something like /sbin/nologin or /bin/false
as a loginshell the -c won't work as expected (as the actual command line being
executed will be:  /bin/false -c your_command_here which is very likely not
going to do what you'd expect ;-).

Read ya, Phil

Note You need to log in before you can comment on or make changes to this bug.