5

I have a .tar.xz file which I would like to detach-sign using my gpg private key.

The problem is, I have multiple of private keys imported to my keyring and need to choose, which one to use.


Progress

This I am trying to execute:

gpg --output somefile.tar.xz.sig --detach-sig somefile.tar.xz --local-user [fingerprint]

but I get an error:

gpg: Note: '--local-user' is not considered an option
gpg: can't open '--local-user': No such file or directory
gpg: signing failed: No such file or directory

What am I doing wrong here and how do I fix it?

1 Answer 1

6

Solution

I have been to remedy the situation using the following working example:

gpg --local-user [fingerprint] --sign --armor --output somefile.tar.xz.asc --detach-sig somefile.tar.xz

Parsing

  • gpg: the program doing the signing; in my case version 2.2.4

  • --local-user: takes an ID as an argument or a fingerprint in my case.

  • --sign: action for gpg to do.

  • --armor: outputs human-readable characters instead of binary.

  • --output: takes a non-existing file name as an argument, this is to be the result of gpg's work. In case it exists, it will ask you if you wish to overwrite.

  • --detach-sig: instructs gpg not to sign the file directly and create a separate signature file.


Non-working examples

  1. If you put the --local-user and its argument on the end, instead of the beginning, you will get the error as is in my question:

    gpg --sign --armor --output somefile.tar.xz.asc --detach-sig somefile.tar.xz --local-user [fingerprint]
    

    So, the --local-user and its argument shall come first (if possible).

  2. If you reverse the --output and --detach-sig, you will get an error similar to what is my question:

    gpg --local-user [fingerprint] --sign --armor --detach-sig somefile.tar.xz --output somefile.tar.xz.asc
    

Conclusion

The order of given arguments matters. That is why it failed.

1
  • Traditionally, unix commands required that their options come before regular arguments. Some more recent commands and versions (especially GNU tools) allow options anywhere in the list, but this is far from universal. Oct 13, 2018 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.