Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 "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?

share|improve this question

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:

tar --exclude=/sys --exclude=/dev --exclude=/proc -cjvvf - / > ~/file.tar.bz2

Then on the windows box, use:

scp root@someServer:~/file.tar.bz2 .
(password prompt)
share|improve this answer
You know I might have enough room on the hard drive of the source machine to do that. – Justin Dearing Sep 10 '10 at 11:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.