Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: How to move public and private GPG keys to another machine using a USB drive

  1. #1
    Join Date
    Nov 2007
    Beans
    331
    Distro
    Ubuntu 12.04 Precise Pangolin

    Question How to move public and private GPG keys to another machine using a USB drive

    I have used Seahorse to create a GPG key for public key encryption.
    I want to use the same key on another machine.
    How do I get the key - public and private, into a usb drive and then into seahorse on the other machine?

    Thank you!
    Linux-libre ask for it
    Coreboot Free software to replace proprietary BIOS
    Trisquel a fully free GNU/Linux-libre distribution
    Open Source does not mean Free My Spec Earthlings

  2. #2
    Join Date
    Jun 2011
    Beans
    357

    Re: How to move public and private GPG keys to another machine using a USB drive

    I don't know about Seahorse specifically, but you can copy GPG keys (public and private) between machines by copying the ~/.gnupg folder from your current account on the old machine to your account on the new machine.

  3. #3
    Join Date
    Nov 2007
    Beans
    331
    Distro
    Ubuntu 12.04 Precise Pangolin

    Question Re: How to move public and private GPG keys to another machine using a USB drive

    Thank you, thenewguy!

    What is the path to /.gnupg? I did a search for it on thenk file system and nothing turned up.

    I think that the . in /.gnupg means that it is a hidden file. Maybe I need to tweak my folder browser to show hidden files somehow...
    Linux-libre ask for it
    Coreboot Free software to replace proprietary BIOS
    Trisquel a fully free GNU/Linux-libre distribution
    Open Source does not mean Free My Spec Earthlings

  4. #4
    Join Date
    Nov 2007
    Location
    Newry, Northern Ireland
    Beans
    1,258

    Re: How to move public and private GPG keys to another machine using a USB drive

    You can also export the secret key from the terminal, as long as it will be imported on another GPG machine.

    Code:
    gpg --export-private-key [key-ID] -ao keyname.asc
    Useful links:
    https://help.ubuntu.com/community/GnuPrivacyGuardHowto
    http://www.gnupg.org/documentation/manpage.en.html
    Can't think of anything profound or witty.
    My Blog: http://gonzothegeek.blogspot.co.uk/

  5. #5
    Join Date
    Nov 2007
    Beans
    331
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to move public and private GPG keys to another machine using a USB drive

    I tried this:

    Code:
    gpg --export-private-key [12345] -ao mykeyname.asc
    and this:

    Code:
    gpg --export-private-key 12345 -ao mykeyname.asc
    Both times I received the following error message:

    Code:
    gpg: Invalid option "--export-private-key"
    Linux-libre ask for it
    Coreboot Free software to replace proprietary BIOS
    Trisquel a fully free GNU/Linux-libre distribution
    Open Source does not mean Free My Spec Earthlings

  6. #6
    Join Date
    Nov 2007
    Location
    Newry, Northern Ireland
    Beans
    1,258

    Re: How to move public and private GPG keys to another machine using a USB drive

    Sorry, my mistake.

    Code:
    gpg --export-private-keys [key-ID] -ao keyname.asc
    Have a look at the man page in the second link in my previous post. It details all the different options available.
    Can't think of anything profound or witty.
    My Blog: http://gonzothegeek.blogspot.co.uk/

  7. #7
    Join Date
    Jun 2011
    Beans
    357

    Re: How to move public and private GPG keys to another machine using a USB drive

    Sorry, the path ~/.gnupg is in your home folder. The "~" at the beginning is a symbol which means your home folder. So if your username is "robert" then the folder with your keys is

    /home/robert/.gnupg/

  8. #8
    Join Date
    Nov 2007
    Beans
    331
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to move public and private GPG keys to another machine using a USB drive

    I tried looking for the /.gpg folder, but it is hidden and I do not know how to reveal hidden files. I don't know how to switch from having icons depicting the path in the folder browser to having a text line where I can type something in. So I can't use the copying the contents of the .gpg folder method at the moment.

    I tried the command line to export the .asc file, and I finally got that to work. I checked the file contents in a text editor and it looked good. I transferred it to another machine and succesfully imported it into Seahorse.

    Unfortuately, it arrived in the "Other Keys" section, instead of my private keys section. I can use it to encrypt a file and send it to the owner - myself! But I can't use it to decrypt a message, I believe. Also, I expected to see a photograph on the key, but there wasn't one there.

    I think I must have exported the public key, even though I tried to export a private key using that command in the command line.

    Sorry to trouble you with this!
    Linux-libre ask for it
    Coreboot Free software to replace proprietary BIOS
    Trisquel a fully free GNU/Linux-libre distribution
    Open Source does not mean Free My Spec Earthlings

  9. #9
    Join Date
    Apr 2009
    Beans
    300
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: How to move public and private GPG keys to another machine using a USB drive

    To export your complete key, public/private, from Seahorse do this:


    1. In Seahorse click the "My Personal Keys" tab;
    2. select the key you want to export and right-click and select properties;
    3. click the Details tab and click the button for "Export Complete Key"

  10. #10
    Join Date
    Mar 2006
    Location
    Williams Lake
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: How to move public and private GPG keys to another machine using a USB drive

    Quote Originally Posted by yeehi View Post
    I tried looking for the /.gpg folder, but it is hidden and I do not know how to reveal hidden files. I don't know how to switch from having icons depicting the path in the folder browser to having a text line where I can type something in. So I can't use the copying the contents of the .gpg folder method at the moment.

    I tried the command line to export the .asc file, and I finally got that to work. I checked the file contents in a text editor and it looked good. I transferred it to another machine and succesfully imported it into Seahorse.

    Unfortuately, it arrived in the "Other Keys" section, instead of my private keys section. I can use it to encrypt a file and send it to the owner - myself! But I can't use it to decrypt a message, I believe. Also, I expected to see a photograph on the key, but there wasn't one there.

    I think I must have exported the public key, even though I tried to export a private key using that command in the command line.

    Sorry to trouble you with this!
    You can press Ctrl-h in nautilus to show hidden files graphically, or:

    Code:
    ls -la
    In a terminal.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •