Pulling and Pushing with SSH

The usual way is to pull data. This is often more secure. Say you have a web server and a file server for backup. The backup server is likely more trustworthy than the web server. You don't want to be typing your backup server password on a possibly compromised web server. So from the backup server, you type:

ssh someuser@mywebserver.com tar -cvf - some-folder >some-folder.tar

The dash tells tar to use standard output for the -f option. The redirection to some-folder.tar is interpreted by the local shell.

But sometimes, you are working on a server, already logged in, and you consider the server secure. Say a virtual host system. You want to run a program and send the output to another machine, a backup server or another virtual host, without leaving an intermediate file laying around. This is slightly more obscure:

virsh dumpxml some-guest |ssh someuser@some-other-host 'cat - >some-guest.xml-`date +%F`'

Here the dash tells cat to read sandard input. The single quotes keep the redirection of the output of cat on the remote host.

-`date +%F` adds a timestamp to the filename.


2011-08-10

Navigation

Home

08/24/12: all new material is at robzweb.com

computers:
09/26/03: Building the standard workstation
Integral Yoga® Upper West Side
1/22/05: Notes on NFS and Moving Data
7/18/05: taring  /
09/14/06: Five Fortunes
11/28/06: .sv files
12/19/06: Excel Formulas and Macros
05/26/08: linux notebook
08/10/11: Pulling and Pushing with SSH

warm and fuzzy:
01/11/03: Gandhi Bibliography
10/31/04: Polly's Halloween Costume
12/13/05: Integral Yoga at Sunflowers Loft
12/29/06: Contact Information
09/02/07: Vacation 07

Does it validate?

Design from: glish.com , thankx

The Moon is Waxing Gibbous (88% of Full)