Subject: Re: Problems with scp against Solaris
To: None <>
From: Christian Biere <>
List: tech-net
Date: 11/14/2006 16:00:48
Jan Danielsson wrote:
> Hubert Feyrer wrote:
> > On Tue, 14 Nov 2006, Jan Danielsson wrote:
> >>   Does anyone recognize this behavior? Was it something I did, or could
> >> the problem be in the Solaris system at the university?
> > 
> > I'm using NetBSD's scp from/to Solaris ~forever, and can't remember any
> > problems that weren't homemade, e.g. by frobbing with stty in
> > .login/.cshrc on the Solaris side.
>    I don't even have a .login file. Could this be related to the
> problem(s)? I do have a .bash_login, but it is so simple that I doubt it
> could be causing much harm. (Famous last words).

A simple "echo hi" would break scp, sftp and others. You have to use something
like below to prevent printing anything to the terminal or having stty messing
with it:

if [ -t 0 ]; then
  # Interactive stuff goes here like echo, stty etc.

Basically, for non-interactive use (scp, sftp) only set environment variables,
umask and ulimit. In the latter case keep in mind that ulimit (implementations
differ anyway) may also print something to the terminal. So whatever program
you run from your login scripts, be sure to redirect standard output and
standard error output to /dev/null, for example,

	ulimit -n 32 >/dev/null 2>&1

rather than just

	ulimit -n 32