I have a huge directory I want to copy to another machine as a .tar.gz file. I don't have a lot of space on either machine, so I'd like to copy the file through a pipe, like this:

tar -czf - mydirectory | ssh other.machine.science "cat > file/location/myfile.tar.gz"

The computer I'm logging in to has my shell set to nologin, though, as I am only allowed to copy files on and off of it with scp.

How can I copy a file from a pipe to a system where I don't have shell access?

1 Answer 1


You could just use scp -r to copy your local directory recursively. This will use more space on the remote end than a compressed tar file, but there seems to be little point in copying such a file without the ability to extract it.

scp -r mydirectory other.machine.science:/path/to/newdirectory
  • The machine is literally a tape archive, and copying a large number of files to it is a bad idea.
    – Dan
    Commented Nov 22, 2016 at 23:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .