strange behaviour with ssh / stdin

Laurent Bartholdi laurent at math.berkeley.edu
Tue Oct 14 11:56:07 EST 2003


hi,
i noted the following strange behaviour using ssh and linux. this is
probably a low-priority bug:

# ssh -V
OpenSSH_3.6.1p2, SSH protocols 1.5/2.0, OpenSSL 0x0090701f
# uname -a
Linux funnyfarm 2.4.21-20.1.2024.2.1.nptl #1 Fri Jul 11 06:04:52 EDT 2003 i686 i686 i386 GNU/Linux

# echo Hello | ssh frodo 'cat'
Hello
# echo Hello | ssh frodo 'cat /proc/self/fd/0'
cat: /proc/self/fd/0: No such device or address
# ssh frodo 'ls -l /proc/self/fd/0'
lrwx------    1 root     root           64 Oct 13 18:51 /proc/self/fd/0 -> socket:[27105]

this is a bit surprising: some applications require a file as input, and
usually specifying /proc/self/fd/0 allows the standard input to be treated
as a file; e.g. some arguments it tar(1) that require a file list. the
command above, with 'cat /proc/self/fd/0' as argument, could then be
entered as
# echo Hello | ssh frodo 'cat | cat /proc/self/fd/0'
Hello

best, laurent
--
Laurent Bartholdi                  \  laurent at math.berkeley.E-D-U
1073 Evans Hall, Dept of Mathematics\   Phone: +1 (510) 6423529
U.C. Berkeley, CA 94720-3840, U.S.A. \   Fax: +1 (510) 6428204




More information about the openssh-unix-dev mailing list