Guest User

Untitled

a guest
Sep 23rd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. # backup-over-network
  2. Some example commands for quickly saving files on a nearby machine.
  3.  
  4. It can be timesaver to archive, compress, upload and save big files, like virtual machines, all in one step.
  5.  
  6. If you are unfamiliar with those commands, you should learn about **tar**, **gzip**, **tee**, and **netcat**.
  7.  
  8. First, you should try sending some data using netcat to the other computer, meaning there isn't anything (firewall, anti-virus) that will block you. Then, type one command on a computer, and the other command on another computer, always with the server first. You will need to change the command to match your file names, ip address, and port.
  9.  
  10. Reversing client/server can be useful in case of restrictive firewalls.
  11.  
  12. ### Client sends to server; Compress server side
  13. ferdodo@server:~$ nc -l 1234 | tee FILES.tar.gz | tar tvzf - && echo Done.
  14. ferdodo@client:~$ tar czf - FILES | nc -q 1 localhost 1234
  15.  
  16. ### Client sends to server; Compress client side
  17. ferdodo@server:~$ nc -l 1234 | gzip | tee FILES.tar.gz | tar tvzf - && echo Done.
  18. ferdodo@client:~$ tar cf - FILES | nc -q 1 localhost 1234
  19.  
  20. ### Server sends to client; Compress server side
  21. ferdodo@server:~$ tar czf - FILES | nc -l 1234
  22. ferdodo@client:~$ nc localhost 1234 | tee FILES.tar.gz | tar tz
  23.  
  24. ### Restore a backup from server to client
  25. ferdodo@server:~$ gzip -c -d FILES.tar.gz | nc -l 1234
  26. ferdodo@client:~$ nc localhost 1234 | tar xvf -
  27.  
  28. ### Restore a backup from client to server
  29. ferdodo@server:~$ nc -l 1234 | tar xvzf - && echo Done.
  30. ferdodo@client:~$ cat FILES.tar.gz | nc -q 1 localhost 1234
Add Comment
Please, Sign In to add comment