Just found out a really neat, convenient way to transfer folders encrypted and peer-to-peer on Unix/Linux.
Destination:
$ nc -l -p 10002 | gpg -d | tar -xv
Source:
$ tar -c [folder] | gpg -c | nc [dest's hostname] 10002
I was aware of something like this before, but hadn't polished it off.
#Unix #Linux #commandLine #lifehack
@lack That's pretty slick, and just one command on the source host, no need to manually enter the command on the destination host. This does ofc require ssh to be set up on the hosts though.
I didn't think about it, but since my command uses `gpg -d`, a malicious actor *could* send something publickey-encrypted, yeah... one would need to check its output (which currently could get drowned in tar's verbose mode output). Also, adding --no-symkey-cache to gpg -d might be a good idea in this case.
@golemwire
I like that your solution would work on a system without sshd running, and can be initiated by a non-root user (assuming there's no firewall in place that would block incoming traffic on the destination host)
And the window for potential attack is low since it would be hard to guess the port number you choose, and probably have a fairly short window of time where it's open on the receiving side anyway. So I think this has its place too :)