LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   LinuxQuestions.org Member Success Stories (https://www.linuxquestions.org/questions/linuxquestions-org-member-success-stories-23/)
-   -   GPG Key Importing over SSH (https://www.linuxquestions.org/questions/linuxquestions-org-member-success-stories-23/gpg-key-importing-over-ssh-4175592425/)

TB0ne 10-28-2016 10:48 AM

GPG Key Importing over SSH
 
One thing that can be irritating is having files that are PGP encrypted on one machine, and having to decrypt them on another, when you haven't moved the key over yet. A common scenario would be when you build a new machine, and want a backup of your data from a second box.

That's fine...you copy the PGP encrypted data over, then try to use it. But, the new box gives you:
Code:

gpg: decryption failed: No secret key
After copying keys on thumb drives and/or over the network, there had to be an easier way. This is one-step, and only needs SSH access between the two boxes.

First, this presumes that you've already set up PGP on both boxes, along with the necessary passphrases, etc. Once that's done, run this on the command line:
Code:

ssh user@192.193.194.195 "gpg --export-secret-key SomeKeyName" | gpg --import
A box will pop up, asking you to enter your local passphrase. Key is imported, and then all the files you encrypted on the first box can be decrypted on the second.


All times are GMT -5. The time now is 01:29 AM.