Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # backup-over-network
- Some example commands for quickly saving files on a nearby machine.
- It can be timesaver to archive, compress, upload and save big files, like virtual machines, all in one step.
- If you are unfamiliar with those commands, you should learn about **tar**, **gzip**, **tee**, and **netcat**.
- 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.
- Reversing client/server can be useful in case of restrictive firewalls.
- ### Client sends to server; Compress server side
- ferdodo@server:~$ nc -l 1234 | tee FILES.tar.gz | tar tvzf - && echo Done.
- ferdodo@client:~$ tar czf - FILES | nc -q 1 localhost 1234
- ### Client sends to server; Compress client side
- ferdodo@server:~$ nc -l 1234 | gzip | tee FILES.tar.gz | tar tvzf - && echo Done.
- ferdodo@client:~$ tar cf - FILES | nc -q 1 localhost 1234
- ### Server sends to client; Compress server side
- ferdodo@server:~$ tar czf - FILES | nc -l 1234
- ferdodo@client:~$ nc localhost 1234 | tee FILES.tar.gz | tar tz
- ### Restore a backup from server to client
- ferdodo@server:~$ gzip -c -d FILES.tar.gz | nc -l 1234
- ferdodo@client:~$ nc localhost 1234 | tar xvf -
- ### Restore a backup from client to server
- ferdodo@server:~$ nc -l 1234 | tar xvzf - && echo Done.
- ferdodo@client:~$ cat FILES.tar.gz | nc -q 1 localhost 1234
Add Comment
Please, Sign In to add comment