Created
November 4, 2014 12:25
-
-
Save Avaq/e31ddbd427cffbeab734 to your computer and use it in GitHub Desktop.
Exporting and importing GPG keys over SSH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ssh user@remote gpg --export-secret-key KeyId | gpg --allow-secret-key-import --import |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Based on key ID. | |
| ssh user@remote gpg --export KeyId | gpg --import | |
| # Based on key owner name. | |
| ssh user@remote gpg --export -a KeyOwnerName | gpg --import |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gpg --export-secret-key KeyId | ssh user@remote gpg --allow-secret-key-import --import |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gpg --export KeyId | ssh user@remote gpg --import |
@Jacob-Stevens-Haas I also have this error. you must add the
--batchparameter to the importing gpg. eggpg --armor --export-secret-keys $KEY_ID | ssh aiden@10.0.4.46 gpg --allow-secret-key-import --import --batchgpg (GnuPG) 2.3.7
I'm getting:
gpg: [stdout]: write error: Broken pipe
gpg: build_packet(6) failed: Broken pipe
gpg: WARNING: nothing exported
%
When running % gpg --export-secret-key 579C2BBCCCCCCCCCCC1E412E63EEFEE963335F9 | ssh mariano@192.168.0.23 gpg --allow-secret-key-import --import --batch
Running a more verbose output:
% gpg --export-secret-key 579C2BBCCCCCCCCCCC1E412E63EEFEE963335F9 | ssh mariano@192.168.0.23 gpg --allow-secret-key-import --import --batch -vvv
gpg: [stdout]: write error: Broken pipe
gpg: build_packet(6) failed: Broken pipe
gpg: WARNING: nothing exported
mariano@Marianos-MacBook-Pro ~ % gpg -vvv --export-secret-key 579C2BBCCCCCCCCCCC1E412E63EEFEE963335F9 | ssh mariano@192.168.0.23 gpg -vvv --allow-secret-key-import --import --batch
gpg: using character set 'utf-8'
gpg: enabled compatibility flags:
gpg: writing to stdout
gpg: key EB37B83B18B8FFFFFFFFFEA36F40E14F47C: asking agent for the secret parts
gpg: pinentry launched (12819 curses 1.3.2 /dev/ttys000 xterm-256color /private/tmp/com.apple.launchd.yEdAjAw04N/org.xquartz:0 20620/501/4 501/20 0)
gpg: [stdout]: write error: Broken pipe
gpg: build_packet(6) failed: Broken pipe
gpg: WARNING: nothing exported
mariano@Marianos-MacBook-Pro ~ %
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I ran into several problems, the following should solve them:
error sending to agent: No pinentry: just installpinentrypackage on target machine.error sending to agent: No such file or directory: just like @aidenscott2016 said, need to add--batchparameter with--importtogether.echo pinentry-mode loopback >> ~/.gnupg/gpg-agent.confand restart gpg agent aftergpgconf --kill gpg-agentshould fix it.