Re: Preferred Backup Method?
- To: debian-user@lists.debian.org
- Subject: Re: Preferred Backup Method?
- From: cls@truffula.sj.ca.us
- Date: Fri, 7 Dec 2007 20:02:26 -0800
- Message-id: <[🔎] slrnflk5qi.v3.spambait@truffula.sj.ca.us>
- References: <9wNlz-83B-45@gated-at.bofh.it> <9wO7X-WQ-35@gated-at.bofh.it> <9wOrp-1mG-29@gated-at.bofh.it> <9wSlb-7v2-9@gated-at.bofh.it> <9x5s5-3lB-9@gated-at.bofh.it> <9x9YT-2pl-41@gated-at.bofh.it> <9x9YU-2pl-49@gated-at.bofh.it> <9xa8s-2CQ-29@gated-at.bofh.it> <9xbHa-5gt-1@gated-at.bofh.it> <9xc0A-5FG-19@gated-at.bofh.it> <9xevm-1hx-15@gated-at.bofh.it>
[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 user@dest "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 user@dest "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
cls@oobleck:/a8/home/cls$ uname -n
oobleck.example.org
cls@oobleck:/a8/home/cls$ ~.
bash: line 2: ~.: command not found
cls@oobleck:/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
Reply to: