Skip to main content

Generating a public/private keypair

Generating a public and private key in wireguard is super easy! You'll know how to do it in a matter of seconds :D

To generate a private key you should run this

wg genkey | sudo tee /path/to/where/you/want/your/private.key

This will generate your private key, print it to your terminal and write it to a file in the path you specify above

To get the matching public key for this private key, you need only run this!

sudo cat /wherever/your/private/ | wg pubkey | sudo tee /path/to/your/new/public.key