Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to symmetrically encrypt a file using gpg.

$ gpg --encrypt --symmetric $MYFILE

I enter and re-enter a passphrase, then gpg tells me

You did not specify a user ID. (you may use "-r")

Current recipients:

Enter the user ID.  End with an empty line:

I don't know what to enter here. I'm symmetrically encrypting (not public key encrypting) so I don't understand why gpg wants to know who the recipient might be. I don't know what the sort of user id gpg is expecting looks like, and I don't know any gpg user ids anyway. If I just enter an empty line, gpg complains that there are "no valid addressees".

So how do I symmetrically encrypt a file using gpg?

Version: gpg (GnuPG) 1.4.11, as packaged in Ubuntu 11.10.

share|improve this question
up vote 35 down vote accepted

The correct command is gpg --symmetric $MYFILE.

The encrypt option tells it to use public-key encryption. The "id" it is asking for is the id of the public key, which you must have in your keyring. (Usually you use an email address for this, but there are other ways to specify which public key to use.)

Combining the two options, as you did, encrypts the session key with a public key and a symmetric cypher, so that either the private key or the password you enter can be used to decrypt.

share|improve this answer
I just wanted to clarify, but my version of Gnupg, when I pass both --symmetric and --encrypt --recipient foo makes for an encrypted message that requires either the private key of the recpipent or the passphrase. In effect, the passphrase allows decrypting the message without any private key. You should update your answer, so people don't start making bad decisions :-) – mogsie Mar 8 '13 at 9:18
I stand corrected. My bad. – Nathan Grigg Mar 10 '13 at 22:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .