In a past life as a unix admin I would often remotely transfer files by taring them to stdout and piping that output through SSH. Sometimes I placed a "tar -xfp -" on the other end of the pipe as a way to transfer files with permissions. Today I revisited this strategy, except there were two monkey wrenches. The fist that I was copying to a windows machine, and the second was I could not ssh as root to the server I was backing up. Sudo only works from a TTY so logging in as my nynpriviledged account did not work.
In the end, someone found the root password, and discovered that password based root logins were allowed. So I was very easily able to create the backup:
c:\> plink -batch -pw SECRET root@someServer tar --exclude=/sys --exclude=/dev --exclude=/proc -cjvvf - / > file.tar.bz2
However, since the windows machine runs winsshd, I want to know if its possible to pull the tarball from the unix box to the windows box, instead of pushing it. The command I tried was:
tar --exclude=/dev --exclude=/sys --exclude=/proc -cjf - / | ssh [email protected] "type con > d:\foo.tar.bz2"
That lead to the file being created on the windows machine, but no data being written. Is there a way to do it the way I want to?
Is there a reason you're not using scp? Given you have root access on the unix machine, seems you should be able to scp over damn near anything. You should be able to ssh into the unix box, issue the command:
Then on the windows box, use: