Bug 22174
Summary: | bash reads rcfile when it shouldn't | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Tim Waugh <twaugh> |
Component: | bash | Assignee: | Bernhard Rosenkraenzer <bero> |
Status: | CLOSED NOTABUG | QA Contact: | David Lawrence <dkl> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 7.0 | CC: | alburrow, dr |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2000-12-13 10:37:07 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Tim Waugh
2000-12-12 18:25:50 UTC
Thi only happens with BASH_ENV set, just like the documentation says. Thanks to Chet Ramey for diagnosing. This bug should be reopened for RedHat 7.2 and openssh-2.9p2-12. OpenSSH is causing the "~/.bashrc" file to be read for non-interactive shells. To see this do the following. + For each F in "/etc/ssh/sshrc", "~/.ssh/rc", "/etc/profile", "~/.bash_profile", "/etc/bashrc", and "~/.bashrc" on the host and target account do the following. - Prepend the lines (replacing %F with the filename) echo "In %F for USER=\"${USER}\"," >> /tmp/ssh-errors.txt echo "with PS1=\"${PS1}\"," >> /tmp/ssh-errors.txt echo "with ENV=\"${ENV}\", and" >> /tmp/ssh-errors.txt echo "with BASH_ENV=\"${BASH_ENV}\"." >> /tmp/ssh-errors.txt - Comment out the usual references to other rc files. Now for a warm up see what happens when you execute /bin/bash -c "/usr/bin/env" from within the target account. According to http://www.snailbook.com/faq/sftp-corruption.auto.html this is the intended effect of running ssh, scp, etc. So have a look at "/tmp/ssh-errors.txt". On my RedHat 7.2 box it remains empty because this is neither a login nor an interactive shell. However, when we do the same from another RedHat 7.2 host via the OpenSSH command ssh andrew@hostname "/usr/bin/env" "/tmp/ssh-errors.txt" now contains the lines In .ssh/rc for USER="andrew", with PS1="", with ENV="", and with BASH_ENV="". In .bashrc for USER="andrew", with PS1="", with ENV="", and with BASH_ENV="". The first reference is expected. The sshd(8) manpage explains that "~/.ssh/rc" wil be sourced, but there is no explanation for "~/.bashrc" being sourced. Not even the one caused by the earlier RedHat practice of setting ENV to this file. Furthermore, the shell is clearly non-interactive because PS1 is _not_ set. This is _very_ annoying because it means there is nowhere to put stty commands or send messages at login, because OpenSSH wil stupidly invoke these interactive shell resources. Thanks Andrew My mistake --- wrong bug report number, I'll go and affix this to an OpenSSH bug where I thought I was typing it. |