Subject: Bug#419641: marked as done (scp, sftp: copying
files fails, when .bashrc om remote server
produces output)



Your message dated Tue, 17 Apr 2007 09:05:33 +0100
with message-id <[email protected]>
and subject line Bug#419641: scp, sftp: copying files fails, when .bashrc om
remote server produces output
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere. Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message --- Package: openssh-client
Version: 1:4.3p2-9
Severity: important

*** Please type your report below this line ***

Hi,

It is not possible anymore to copy files to/from hosts with scp, when .bashrc on the server side produces any output. sftp also fails.

to demonstrate:

client> echo bla > bla
client> scp bla server:
bla 100% 89 0.1KB/s 00:00 client>
client> # this works fine
-----------------

server side, bash as shell for the user
client> ssh server
server> echo "hello world" >> .bashrc

-----------

client side:
client> echo bla > bla
client> scp bla server:
hello world
client>
client> # file was not copied

This behavior is present in scp from the latest openssh-client (4.3p2-9) and was
also present in 4.3p2-8, while 4.2p1-4 does copy files correctly.
Only the version of the client seems to matter.
scp -v -v does not produce additionally helpful information, so I am not including its output.

Regards,
I.

-- System Information:
Debian Release: 4.0
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-3-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages openssh-client depends on:
ii adduser 3.63 Add and remove users and groups
ii debconf [debconf-2. 1.4.30.13 Debian configuration management sy
ii dpkg 1.13.25 package maintenance system for Deb
ii libc6 2.3.6-7 GNU C Library: Shared libraries
ii libcomerr2 1.37-2sarge1 common error description library
ii libedit2 2.9.cvs.20050518-2.2 BSD editline and history libraries
ii libkrb53 1.4.3-5 MIT Kerberos runtime libraries
ii libncurses5 5.5-1 Shared libraries for terminal hand
ii libssl0.9.8 0.9.8c-4 SSL shared libraries
ii passwd 1:4.0.3-31sarge9 change and administer password and
ii zlib1g 1:1.2.3-9 compression library - runtime

openssh-client recommends no packages.

-- no debconf information


--- End Message --- --- Begin Message --- tags 419641 wontfix
thanks

On Tue, Apr 17, 2007 at 07:15:40AM +0200, [email protected] wrote:
> It is not possible anymore to copy files to/from hosts with scp, when
> .bashrc on the server side produces any output. sftp also fails.

I don't regard this as a bug, and it's in upstream's FAQ:

http://www.openssh.org/faq.html#2.9

# 2.9 - sftp/scp fails at connection, but ssh is OK.
#
# sftp and/or scp may fail at connection time if you have shell
# initialization (.profile, .bashrc, .cshrc, etc) which produces output
# for non-interactive sessions. This output confuses the sftp/scp
# client. You can verify if your shell is doing this by executing:
#
# ssh yourhost /usr/bin/true
#
# If the above command produces any output, then you need to modify your
# shell initialization.

I would advise modifying your .bashrc to produce output only when the
shell is interactive. For instance:

if [ "$PS1" ]; then
echo hello world
fi

Or:

case $- in
*i*)
echo hello world
;;
esac

Cheers,

--
Colin Watson [[email protected]]

--- End Message ---



Programming list archiving by: Enterprise Git Hosting