[This message has also been posted to linux.debian.user.] On Wed, Dec 05, 2007 at 03:35:46PM -0800, David Brodbeck wrote: > > On Dec 5, 2007, at 3:16 PM, Michael Pobega wrote: >> tar cvvf foo.tar bar | ssh [EMAIL PROTECTED] "cat > foo.tar" >> >> Or am I doing it wrong (I most likely am)? I've never done any sort of >> piping through SSH before, so any sort of help would be appreciated. > > You're close. Try this: > > tar cvvf - bar | ssh -e none [EMAIL PROTECTED] "cat >foo.tar" > > Using - as the filename tells tar to output to stdout. "-e none" disables > SSH's escape character, making the session fully transparent -- otherwise > SSH will go into command mode if your tar output happens to contain a line > that starts with ~.
What? I've moved many gigabytes through tar cf - stuff | ssh remotebox tar xf - If there were a problem with tilde dot in the stream I would have seen it by now. Let's try an experiment with Debian boxes truffula (local) and oobleck (remote). truffula$ cat | ssh oobleck "cat > foo.bar" this is a line ~. this is another line <control-D> You have new mail in /home/cls/.mbox truffula$ truffula$ ssh oobleck grep -n "''" foo.bar 1:this is a line 2:~. 3:this is another line You have new mail in /home/cls/.mbox truffula$ Well that seems to have worked. (grep -n '' is a trick for numbering the lines of a text file.) truffula$ ssh oobleck Linux oobleck.example.org 2.6.18-5-686 #1 SMP Sun Aug 12 21:57:02 UTC 2007 i686 GNU/Linux No mail. Last login: Sat Nov 24 19:01:19 2007 from 192.168.1.221 oobleck$ pwd /a8/home/cls oobleck$ <tilde><dot>Connection to oobleck closed. truffula$ That shows tilde dot works as advertised when you're talking into a default shell. Wnat if you call a login shell like any other command? truffula$ ssh oobleck bash -l -i [EMAIL PROTECTED]:/a8/home/cls$ uname -n oobleck.example.org [EMAIL PROTECTED]:/a8/home/cls$ ~. bash: line 2: ~.: command not found [EMAIL PROTECTED]:/a8/home/cls$ exit You have new mail in /home/cls/.mbox truffula$ So "ssh host" cares about ~. but "ssh host command" doesn't. No wonder I've been getting away with tar | ssh tar. The "-e none" is not necessary. Cameron -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]