tarring over ssh question - pulling from the source to tarfiles

Malcolm Kay malcolm.kay at internode.on.net
Wed Nov 2 02:45:51 PST 2005


On Wed, 2 Nov 2005 05:51 pm, Glenn Dawson wrote:
> At 11:20 PM 11/1/2005, user wrote:
> >Hello,
> >
> >Sometimes I have a bunch of data that I want to transfer from
> > source to destination over ssh, but I want to tar it up on
> > the way over (that is, I don't have enough space on the
> > source to create a tarball of the data and then just scp the
> > tarball over...)
> >
> >I do that like this:
> >
> >tar cf - /files | ssh user at 10.0.0.10 "cat >
> >/usr/home/user/file_data2.tar"
> >
> >or if I want to split it into multiple files:
> >
> >tar cf - /files | ssh user at 10.0.0.10 "split - -b 1024m
> >/usr/home/user/file_data2.tar"
> >
> >This works just fine.
> >
> >-----
> >
> >My question is, what if I want to initiate this process from
> > the destination machine ?  In the above example, I am on the
> > source machine, and I ssh to the destination, making the tar
> > files as it goes.
> >
> >What if, instead, I am logged into the destination machine,
> > and I want to do the same thing - all from the destination
> > machine ?
> >
> >That is, I know that there is a directory /files on the
> > source that I want, and I have a login to ssh them to me,
> > but I do not want to logon to the source - I want to suck
> > /files to me, but also tar them up on the way.
> >
> >Is that possible ?  rsync/rdist are not available.  I need to
> > do this over ssh and tar, as in the above examples.
>
> rsync would be a much better choice for your needs.
>

You must have more information than revealed in the query to know 
this. "user" does say that he requires a tar file.

To "user"

From the other end:-
% ssh whomever at othermachine tar -f /files | cat  > /usr/home/user/file_data2.tar

Redirection following ssh ( '|' and '>' ) occur at the local 
end unless within quotes.

Thus:
% ssh whomever at othermachine tar -f /files "|" cat  ">" /usr/home/user/file_data2.tar
or:
% ssh whomever at othermachine "tar -f /files | cat  > /usr/home/user/file_data2.tar"
would attempt to create the tar archive on the remote machine.

Malcolm

> -Glenn
>
> >thanks!
> >
> >_______________________________________________
> >freebsd-questions at freebsd.org mailing list
> >http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> >To unsubscribe, send any mail to
> > "freebsd-questions-unsubscribe at freebsd.org"
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe at freebsd.org"


More information about the freebsd-questions mailing list