Subject: Re: scp and .profile in 1.5.1_ALPHA
To: Charlie Allom <charlie@rubberduck.com>
From: Jeremy C. Reed <reed@reedmedia.net>
List: current-users
Date: 04/07/2001 01:01:12
On Fri, 6 Apr 2001, Charlie Allom wrote:
> yet with a current 1.5.1_ALPHA, it does seem to process the
> login, resulting in a broken pipe, when it executes fortune.

I couldn't duplicate this with
sshd version OpenSSH_2.5.1 NetBSD_Secure_Shell-20010219
(from cvs netbsd-1-5 today).

On Sat, 7 Apr 2001, Charlie Allom wrote:

>  yeled@enki:/usr/home/yeled$ scp -v du2.c 210.15.192.23:~
> Executing: program /usr/bin/ssh host 210.15.192.23, user
> (unspecified), command scp -v -t ~
> yeled@210.15.192.23's password:
> Q:  How many DEC repairmen does it take to fix a flat ?
>  yeled@enki:/usr/home/yeled$ Write failed flushing stdout buffer.
> write stdout: Broken pipe

What are those error messages from?

> yep, a `touch' in place of the fortune works, and the scp
> executes nicely.
> 
> removing the .profile also gets the scp working.

Strange.

It looks like the scp is started with your user shell with "-c". Maybe you
use .bashrc, .cshrc, ~/.ssh/rc, or you are passing some custom ENV that
also runs .profile.

What does your sshd -d say? For example, on the server try:

 sshd -d -p2200

and on your client try:

 scp -v -P 2200 file.c server-name:test

Maybe some of this debugging can help track down this issue.

It might be interesting to turn on process accounting or run sshd via
ktrace.

As root, try:
 ktrace -id sshd -d -p2200
Then on the other machine, use scp to transfer a file to it:
 scp -v -P 2200 some-file.c server-running-sshd-on-port-2200:.
This will create a ktrace.out file that can be viewed with
 kdump | less
Search for "profile" in it.

   Jeremy C. Reed
   http://www.reedmedia.net/