openssh-SNAP-20001207 scp "Bad file descriptor" sort-of work-around

Rob Hagopian rob at hagopian.net
Thu Dec 7 16:31:02 EST 2000


Indeed, I've had users do that and it took me a bit to figure out why...
Isn't there just a way to just ignore that?
								-Rob

On Thu, 7 Dec 2000, Damien Miller wrote:

> On Wed, 6 Dec 2000, James wrote:
> 
> > Everything seems to work, though I still have trouble with scp.  The
> > behaviour is not protocol dependent - acts the same with either.  (Using
> > RedHat 6.2)
> > 
> > When I scp <file> <host>:<dir>, bash is invoked as a login shell on the
> > server side host - this doesn't seem right.  With my /etc/profile, I get
> 
> 
> Do you have something in your profile or shell rc which causes text to 
> be displayed on non-interactive logins? 
> 
> What does "ssh localhost true" say?
> 
> You mustn't have junk being printed for non-interactive sessions.
> 
> -d
> 
> >  Dec  6 15:06:20 amethyst sshd[3027]: error: select: Bad file descriptor
> > 
> > in the log (something doesn't like my script), and
> > 
> >  sourcing /etc/profile...
> >  Connection to <host> closed by remote host.
> > 
> > on the client side.  (My /etc/profile generates the "sourcing
> > /etc/profile..." message.)
> > 
> > If instead I mv /etc/profile /etc/profile.tmp, scp is successful.  strace
> > then gives, toward the end:
> > 
> >  open("/etc/passwd", O_RDONLY)           = 3
> >  fcntl(3, F_GETFD)                       = 0
> >  fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
> >  fstat(3, {st_mode=S_IFREG|0644, st_size=2335, ...}) = 0
> >  old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
> >  0) = 0x40015000
> >  read(3, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 2335
> >  close(3)                                = 0
> >  munmap(0x40015000, 4096)                = 0
> >  ioctl(2, TCGETS, 0xbffff734)            = -1 EINVAL (Invalid argument)
> >  rt_sigaction(SIGPIPE, {0x804b0bc, [], SA_RESTART|0x4000000}, {SIG_DFL}, 8)
> >  = 0
> >  pipe([3, 4])                            = 0
> >  pipe([5, 6])                            = 0
> >  pipe([7, 8])                            = 0
> >  close(3)                                = 0
> >  close(4)                                = 0
> >  fork()                                  = 21936
> >  close(5)                                = 0
> >  close(8)                                = 0
> >  read(7, bash: /etc/profile: No such file or directory
> >  bash: cma: command not found
> >  "\0", 1)                        = 1
> >  open("ssh-copy-id", O_RDONLY)           = 3
> >  fstat(3, {st_mode=S_IFREG|0644, st_size=1144, ...}) = 0
> >  write(6, "C0644 1144 ssh-copy-id\n", 23) = 23
> >  read(7, "\0", 1)                        = 1
> >  fstat(3, {st_mode=S_IFREG|0644, st_size=1144, ...}) = 0
> >  brk(0x8051000)                          = 0x8051000
> >  read(3, "#!/bin/sh\n\n# Shell script to ins"..., 1144) = 1144
> >  write(6, "#!/bin/sh\n\n# Shell script to ins"..., 1144) = 1144
> >  close(3)                                = 0
> >  write(6, "\0", 1)                       = 1
> >  read(7, "\0", 1)                        = 1
> >  _exit(0)
> > 
> > ("cma" is a missing command from /etc/profile called from ~/.profile.
> > "ssh-copy-id" is the test file I'm trying to scp.)
> > 
> > When scp breaks, the very end looks like:
> > 
> >  read(7, ".", 1)                         = 1
> >  read(7, "\n", 1)                        = 1
> >  write(2, "sourcing /etc/profile...\n", 25sourcing /etc/profile...
> >  ) = 25
> >  _exit(1)                                = ?
> >  Connection to <host> closed by remote host.
> > 
> > 
> > So, is starting a bash login shell correct behavior for scp?
> > 
> > This login shell behaviour is a problem, as you can see.  An incompatibility
> > with /etc/profile or ~/.profile kills scp - uhg.
> > 
> > Might I have misconfigured something in ssh_config or sshd_config? or
> > compiling the package?  I have:
> > 
> >  OpenSSH configured has been configured with the following options.
> >                  User binaries: /usr/bin
> >                  User binaries: /usr/bin
> >                System binaries: /usr/sbin
> >            Configuration files: /etc/ssh
> >                Askpass program: /usr/libexec/ssh-askpass
> >                   Manual pages: /usr/man/manX
> >                       PID file: /var/run
> >       Random number collection: Device (/dev/urandom)
> >                 Manpage format: man
> >                    PAM support: yes
> >             KerberosIV support: no
> >                    AFS support: no
> >                  S/KEY support: yes
> >           TCP Wrappers support: yes
> >           MD5 password support: no
> >    IP address in $DISPLAY hack: no
> >       Use IPv4 by default hack: no
> >        Translate v4 in v6 hack: yes
> > 
> >              Host: i686-pc-linux-gnu
> >          Compiler: gcc
> >    Compiler flags: -g -O2 -Wall -I. -I. -I/usr/include
> >      Linker flags:  -L/usr/lib -L/usr
> >         Libraries: -ldl -lnsl -lz  -lutil -lpam -lcrypto  -lskey -lwrap
> > 
> > 
> > Please Cc me on any response, as I'm not subscribed to the list.  Thanks.
> > 
> > 
> > James Feeney
> > 
> > 
> > 
> 
> 






More information about the openssh-unix-dev mailing list