Wednesday 23 May 2018


How To Export GPG(PGP) Private Key From Machine-1 & Import On Machine-2.


Use this command to check the private key status of machine1.
#gpg --list-secret-keys

Use this command to export your private key from machine1.
#gpg --export-secret-keys Key_ID > private-key.asc

Run this command on machine1.
Use SCP command to copy private key from machine1 to machine2.
 # scp -r  private-key.asc username@machine2_IP:/tmp/

Run this command on machine2.
Use this command to Import machine1 private key on machine2.
#gpg --import private-key.asc

Check the key install or not on machine2.
 #gpg --list-secret-keys
 
 
####Issues:
·         If the key is already installed on machine2 then you get error the Key already known' so you need to delete the both the private and public key on machine2. (First you need to delete public key then private key)

Delete Public key.
#gpg --delete-keys 

Delete Private key. 
#gpg --delete-secret-keys