Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8225423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:24:47+00:00 2026-06-07T15:24:47+00:00

I am trying to automate backups with duplicity , but when I test the

  • 0

I am trying to automate backups with duplicity, but when I test the result, I get

gpg: public key decryption failed: bad passphrase

I want to check whether the passphrase I am using is actually the passphrase associated with the corresponding gpg secret-key, but I can’t see anyway in the gpg command-line options to say “Don’t encrypt or decrypt anything. Just confirm I am using the right passphrase.”

This suggests that maybe I am (yet again) misunderstanding Gnu Privacy Guard. (It has a predilection for taunting me until I cry.)

Does it make sense to ask gpg to verify a passphrase? If so, how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T15:24:49+00:00Added an answer on June 7, 2026 at 3:24 pm

    There is no in-built method for doing this, but it is simple enough to create a test that doesn’t modify anything and allows you to just check your passphrase.

    You didn’t specify, so I will assume you are using GnuPG version less than v2 and are on Linux with Bash for your commandline interpreter.

    I will give the command here and below I will explain what each part does – (note: the following is for GnuPG series version 1, see below for GnuPG series v2)

    echo "1234" | gpg --no-use-agent -o /dev/null --local-user <KEYID> -as - && echo "The correct passphrase was entered for this key"

    What that does is first, pipe some text to sign to GnuPG with echo "1234" | – because we don’t really want to sign anything, this is just a test, so we will sign some useless text.

    Next, we tell gpg to not use the key agent with --no-use-agent; this is important later because, depending on your key agent, it may not return "0" on success, and that is all we want to do – verify success of your passphrase.

    Next, we tell gpg to put the signed data directly into the /dev/null file, meaning we discard it and not write the result to the terminal — NOTE: if you are not using some variant of Linux/Unix, this file may not exist. On windows you may have to just allow it to write the signed data to the screen by just omitting the -o /dev/null part.

    Next, we specify the key we want to do our test with by using --local-user 012345. You can use the KeyID for maximum specificity, or use a username, whichever best suites your needs.

    Next we specify -as, which enables ascii output mode, and sets the context mode for signing. The - afterwards just tells GnuPG to get the data to be signed from standard-in, which is the very first part of the command we gave echo "1234" |.

    And last, we have && echo "A message that indicates success" — the "&&" means, if the previous command was successful, print this message. This is just added for clarity, because the success of the command above would otherwise be indicated by no output at all.

    I hope that is clear enough for you to understand what is going on, and how you can use it do the testing you want to do. If any part is unclear or you do not understand, I will be glad to clarify.

    [EDIT] – If you are using GnuPG v2, the above command will need to be modified slightly, like so:

    echo "1234" | gpg2 --batch --passphrase-fd 1 --local-user <KEYID> -as - > /dev/null && echo "The correct passphrase was entered for this key"

    The reason being, GnuPG v2 expects the passphrase to be retrieved via an agent, so we cannot disable the use of the agent with --no-use-agent and have the desired effect; instead we need to tell GnuPG v2 that we want to run a "batch" process, and retrieve the passphrase from STDIN (standard in) by using the option --passphrase-fd 1.

    Note: Don’t use -o /dev/null as it will delete character device and replace it with an empty file

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to automate tests on asynchronous requests but I haven't been able
I'm trying to automate a program I made with a test suite via a
I'm trying to automate a server request to the client upon connection but I
I'm trying to setup 7zip for automated backups but I'm having trouble with output
trying to automate using perl scripts on windows server using MediaWiki::Bot and Mediawiki::API taken
I'm trying to automate Mac OS X package building via command line interface of
Hello I´m trying to automate AZURE VM management like Amazon EC2. Is there any
I am trying to automate a block appearing on the website and comparing its
I'm trying to automate detection of broken links and I was startled to see
I'm trying to automate the filling of a master excel file from selected rows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.