Red Hat Bugzilla – Bug 165873
shopt -q login_shell in /etc/bashrc fails, blocks scp
Last modified: 2014-03-16 22:55:25 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Description of problem:
otherhost$ scp file fc4-host:.
This just hangs, although ssh, sftp do work, and the
reverse direction (fc4-host to otherhost) works.
[FC4 has openssh-4.1p1-3.1]
openssh.com FAQ #2.9 let me to the problem: /etc/bashrc
is running all the profile.d/*.sh scripts even though
this is a non-interactive session. The culprit is this
if ! shopt -q login_shell ; then # We're not a login shell
My older FC2 system used a different test:
if [ "x$SHLVL" != "x1" ]; then # We're not a login shell
After commenting out the original test and substituting this
one, everything is now working.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.otherhost$ scp file fc4-host:.
Actual Results: Session just hangs (scp -v flag shows keep-alives and that is all)
Expected Results: File "file" should be transferred to fc4-host. (After authentication,
if keys aren't used.)
The test from openssh.com to show the problem was to try:
otherhost$ ssh fc4-host /bin/true
and check for any output (there should be none, but a blank
line is produced. I didn't bother checking the scripts
in /etc/profile.d/*.sh to see which one did that, as none of
those scripts should run at all in this case!)
Fixing component. (/etc/bashrc is owned by the 'setup' package.)
The bug isn't in /etc/bashrc, but in one of the /etc/profile.d/*.sh files. If
the session is a login session then /etc/profile is run which runs all
/etc/profile.d/*.sh scripts. If the session is not a login session (that means
/etc/profile won't run) then /etc/bashrc should run the /etc/profile.d/*.sh
scripts. Bottomline is that the /etc/profile.d/*.sh should run in all cases.
I suggest that the reporter of this bug finds the offending script and reports
the bug to the respecting package. As for this bug, IMO it should be marked as