LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-18-2014, 06:11 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Rep: Reputation: 33
How to copy an gpg-Key from another machine?


as titled.
 
Old 03-18-2014, 08:23 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
copy /path/to/.gnupg/ to it.
 
1 members found this post helpful.
Old 03-18-2014, 08:33 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
If you want to copy only a single GPG key, at first you have to export it from the source machine and then import into the destination. This is what --export and --import options are intended for. Here is a quick howto:
Code:
# In the source machine:
gpg --output <name_of_file_with_public_key>.gpg --armor --export <name_of_key_to_export>
gpg --output <name_of_file_with_secret_key>.gpg --armor --export-secret-key <name_of_key_to_export>
# In the destination machine:
gpg --import <name_of_file_with_public_key>.gpg
gpg --allow-secret-key-import --import <name_of_file_with_secret_key>.gpg
where the parts highlighted in grey are the custom parts. Moreover, you can easily find the name of the current GPG keys using
Code:
gpg --list-keys
Hope this helps.
 
Old 03-18-2014, 09:08 AM   #4
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
Hi,

I find by the source machine folowing .gpg files:
Code:
# find / -name "*.gpg"
/root/.gnupg/secring.gpg
/root/.gnupg/trustdb.gpg
/root/.gnupg/pubring.gpg
And I find these files are created at the same time. Which one should export?
 
Old 03-18-2014, 09:36 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
These are generic GPG keys as shown here: http://www.gnupg.org/documentation/m...iguration.html. Maybe you want to export them all and in this case the advice from Habitual is best suited and quick, but I am in doubt about the usefulness of such transfer since all the keys listed are there for gpg2 internal purposes and maybe they should be automatically created from the local installation of GPG and left alone.
 
Old 03-18-2014, 09:55 AM   #6
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
Hi,

In fact the solution from Habitual works.
 
Old 03-19-2014, 08:40 AM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by thomas2004ch View Post
Hi,

In fact the solution from Habitual works.
Great, but you should be familiar with gnupg export|import as colucix has hinted at
Quote:
Originally Posted by colucix View Post
If you want to copy only a single GPG key, at first you have to export it from the source machine and then import into the destination.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GPG: Bad session key gpg between gpg on linux and gpg gui on windows XP konqi Linux - Software 1 07-21-2009 09:37 AM
gpg can't create same key on different machine! rino.caldelli Linux - Software 7 04-20-2007 12:55 AM
Revoking GPG key with only passphrase and public key djib Linux - Security 2 03-13-2007 03:20 AM
can see gpg key in apt-key, still can't update Dan63043 Ubuntu 2 09-25-2006 11:35 AM
GPG Data, Secret Key but no Public Key? Aeiri Linux - Software 5 07-20-2004 06:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration