Hi I have a process that creates 'some data' and outputs this to standard out and i want to shift this data over ssh to a remote box without ever writing anything locally. I have been experimenting with tar to create the archive as the i dont know what the contents of 'some data' might be so i just need to capture it and output it on the other side. I have been trying with $ tar czf - . | ssh -q 192.168.122.2 "tar xzf -" and this works fine to create an archive of this '.' directory and pipe that over to the other side but i want to take standard out so.... $ tar czf - `the thing that generates standard out here` | ssh -q 192.168.122.2 "tar xzf -" Would that work or is there a better way to get this over to the other side? It needs to be a data stream though so things like scp and rsync are no good and i need to know what the command is on the remote side being run so that i can restrict this in the ssh public key on the remote side. thanks
Tom Brown wrote:> Hi > > I have a process that creates 'some data' and outputs this to standard > out and i want to shift this data over ssh to a remote box without > ever writing anything locally. I have been experimenting with tar to > create the archive as the i dont know what the contents of 'some data' > might be so i just need to capture it and output it on the other side. > > I have been trying with > > $ tar czf - . | ssh -q 192.168.122.2 "tar xzf -" > > and this works fine to create an archive of this '.' directory and > pipe that over to the other side but i want to take standard out > so.... > > $ tar czf - `the thing that generates standard out here` | ssh -q > 192.168.122.2 "tar xzf -" > > Would that work or is there a better way to get this over to the other > side? It needs to be a data stream though so things like scp and rsync > are no good and i need to know what the command is on the remote side > being run so that i can restrict this in the ssh public key on the > remote side. >Why do you need any other process involved to work with a data stream? If you want to collect it to a remote file, you can | ssh remotehost 'cat > path_to_file'. Just be sure to quote the redirection so it happens on the remote side. -- Les Mikesell lesmikesell at gmail.com
At Thu, 12 Aug 2010 13:11:21 +0100 CentOS mailing list <centos at centos.org> wrote:> > Hi > > I have a process that creates 'some data' and outputs this to standard > out and i want to shift this data over ssh to a remote box without > ever writing anything locally. I have been experimenting with tar to > create the archive as the i dont know what the contents of 'some data' > might be so i just need to capture it and output it on the other side. > > I have been trying with > > $ tar czf - . | ssh -q 192.168.122.2 "tar xzf -" > > and this works fine to create an archive of this '.' directory and > pipe that over to the other side but i want to take standard out > so.... > > $ tar czf - `the thing that generates standard out here` | ssh -q > 192.168.122.2 "tar xzf -" > > Would that work or is there a better way to get this over to the other > side? It needs to be a data stream though so things like scp and rsync > are no good and i need to know what the command is on the remote side > being run so that i can restrict this in the ssh public key on the > remote side.Why not just do `the thing that generates standard out here` | ssh -q 192.168.122.2 dd of=somethin eg find . | ssh -q 192.168.122.2 dd of=find.out You don't need tar for anything.> > thanks > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos > >-- Robert Heller -- Get the Deepwoods Software FireFox Toolbar! Deepwoods Software -- Linux Installation and Administration http://www.deepsoft.com/ -- Web Hosting, with CGI and Database heller at deepsoft.com -- Contract Programming: C/C++, Tcl/Tk