How to use sz to transfer directory?

I have 100G files in a root directory data/ on Server1 and I need to transfer from this remote machine to another remote machine Server2. SCP is disabled. I have to use "sz" command. This is the first time I use this command.

I need to first log onto Server2, and ssh to Server1, then issue the 'sz' command. What's the right format to use sz to transfer these files under data/ from Server2 to Server1?

EDIT:

 martin@parser:/data/reviews/ad$ ssh -p 80 "tar -cz /data/ping/2017-10-05" > test.gz Traceback (most recent call last): File "/opt/jumpserver/connect.py", line 877, in <module> main() File "/opt/jumpserver/connect.py", line 828, in main nav.try_connect() File "/opt/jumpserver/connect.py", line 614, in try_connect ssh_tty.connect() File "/opt/jumpserver/connect.py", line 459, in connect win_size = self.get_win_size() File "/opt/jumpserver/connect.py", line 320, in get_win_size x = fcntl.ioctl(sys.stdout.fileno(), TIOCGWINSZ, s)
IOError: [Errno 22] Invalid argument

1 Answer

SZ is not really the correct tool for the job.

The simplest way to do this is to not use sz at all, but to simply use SSH as a pipe. There are lots of variants, but one way to do this would be to to compress the files into a data stream and write that stream to your local system. This can all be done over SSH (leaving you a compressed backup is as follows:

ssh "tar -cz /data" > /path/to/local/filename.gz

If you want to take advantage of compression, but want the original file, you can do something like

ssh "tar -cz /data" | tar -xf 

Which will compress the file into a stream, send it across the connection and decompress it.

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like