[TriLUG] SCP acting funny

Brian A. Henning lugmail at cheetah.dynip.com
Mon Apr 5 13:26:57 EDT 2004


Ah, yes, that definitely seems to be it exactly..  Any output from a bashrc
appears to confuse scp..  Apparently it closes the connection after it sees
a line-feed character in the stdout stream.  Not being a wisened programmer,
I can only speculate as to why it was coded that way.

At any rate, I do not wish to forfeit the output of my ~/.bashrc if I can
avoid it.  Is there any sort of condition I could check to conditionally
branch around the output only when scp is making the connection?  Like some
environment variable or perhaps the parent process that spawns the instance
of bash?  Something akin to this pseudo-shellcode:

if [remote_command ne "scp"]; then
  /usr/local/games/fortune;
  /usr/bin/uptime;
fi

Thanks everyone that offered suggestions.

Cheers,
~Brian


> -----Original Message-----
> From: trilug-bounces at trilug.org [mailto:trilug-bounces at trilug.org]On
> Behalf Of bp
> Sent: Monday, April 05, 2004 8:51 AM
> To: Triangle Linux Users Group discussion list
> Subject: Re: [TriLUG] SCP acting funny
>
>
> On Sun, 4 Apr 2004, James Manning wrote:
>
> > > Could it be the output from /etc/bashrc is somehow confusing the
> > > process?
> >
> > Maybe - as a quick sanity check I'd rename the relevant .bashrc /
> > .profile files (any of them that get run at ssh/scp time, checking
> > access times should help if you're unsure) so they're not run at all
> > during scp.
> >
>
> On RedHat 9 I too noticed this horrible behaviour; any output coming from
> bashrc (welcome to host xyz) caused scp to connect and immediately
> disconnect with no file being transfered. Get rid of the output and the
> issue will be fixed.  This was the case on several of my lab boxes
> recently.
> -bp
>
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc




More information about the TriLUG mailing list