Bits from Matthieu Caneill

Share the clipboard over the wire

Posted: February 02, 2021
Categories: linux

In other words, Ctrl+c on one computer, and Ctrl-v on a different one.

I recently had to log in to a service, using a computer that was not yet configured with my password manager (bootstrapping problems, eh). Since it's clearly not fun to blindly type long random strings, I made this little combination of good'ol Unix pipes, which allowed me to share my encrypted clipboard between the two computers.

On the receiving end, wait for some bytes on port 1234, decrypt them, put the result in the clipboard.

nc -l 1234 | gpg -d | xclip -i

And on the sending end, get the clipboard, encrypt it with a password of my choice, and send the bytes through the network.

xclip -o | gpg -c | nc <RECEIVNG-HOST> 1234

Gotta enjoy that symmetry.

There used to be a comments section here. The current best way to react to things I write is to ping me on Twitter.