ACPI administration advocacy advocacy advocacy opinion alsa amarok apache apple apt aptitude archive audio audo authentication automount avi awk backup bash BIOS boot browser business bzip cache calendar calibre cdr cdrecord censorship commandline computerscience console convert cron cut database date debian degree design desktop development disk dpkg dvd economics education emacs email europe exim faad ffmpeg file files firefox firewall flash foss freedom ftp fun fuse git gnumeric graphics grep growisofs grub gtkpod gzip hardware hardware html icedove idiocy image imagemagick images installation ip iphone ipod iptables iso itunes ivman kde kernel keyboard knoppix lame laptop latex libreoffice linux locale lockin locking longlines lsof m4a microsoft mimetypes minitab mogrify mount mp3 mp4 mplayer multimedia music mysql network nfs nfs4 nmap openbox openfiles openoffice opinion opinion orgmode partition pdf pdftk perl php podcast politics pomodoro ports postgresql print printing privacy process programming rant remote rhythmbox rss rsync rxvt scp screengrab screenshot script scripting scsi security sed server services shell siteadmin sitenews sitesoftware skype skype slackware sound sox spam spreadsheet ssh statistics subversion sudo svk swap t23 t43 tar terminal tex text thinkpad thunderbird time timer timezone ubuntu udev upgrade usb usbmount users uuid versioncontrol vfat video vnc windows wine wordpress wordprocessing X40 xwindows xwindows youtube
The premier tool for copying a file or two from one machine to another is scp. It's simple. It's effective. That's why there's a FAQ, which is will scp accept data from STDIN?
The answer is 'no'.
Some people complain about this, but it's not a bug, it's a feature.
If you want to take a stream of data on a computer and dump it in a file, you don't use the cp command, do you? Rather, you do something like this:
echo "some text" > afile.txt
What's true of an operation on one machine is true of an operation across machines. So, if you have a stream of data produced by a script on one machine and you want it in a file on another machine, that's not copying the data, it's storing some data produced on one machine in a file on another machine.
When the problem is reframed like that, a number of solutions become apparent. Probably the easiest is this:
echo "some text" | ssh firstname.lastname@example.org "cat > /remote/file"
Obviously, echo "some text" should be changed to any command or script that produces a stream of data to STDOUT and the host and file names should be changed as appropriate.
Actually, scp *does* support reading from stdin; it just seems to be undocumented. The scp process on the local machine establishes an ssh connection to the remote machine and then invokes an scp process on the remote machine, and that remote scp process has to read from stdin.
The command > scp foo remote:/path/to/bar
invokes the following on the machine "remote": > ssh -t /path/to/bar
I discovered this while debugging a "validate-rsync" script to use in the "command=" rule for an ssh key.