LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 11-15-2018, 01:18 PM   #1
Mr Marmmalade
Member
 
Registered: Oct 2002
Location: Scotland
Distribution: Slackware + Debian
Posts: 203

Rep: Reputation: 26
gpg question


Howdy, this is likely a silly question but here goes anyway. All done in Debian stable with KDE.

Normally I encrypt files thus:
gpg -c filename.txt > enter password twice.

And decrypt them thus:
gpg filename.txt.gpg > enter password once.

All good usually. I've recently found that if I do:
gpg filename.txt.gpg > press enter by mistake without inputting any pwd, that I get myself into a pickle.

If I then try to decrypt it again, it gives message:

gpg: WARNING: no command supplied. Trying to guess what you mean ...
gpg: AES256 encrypted data
gpg: gcry_kdf_derive failed: Invalid data
gpg: encrypted with 1 passphrase
gpg: decryption failed: No secret key

From DuckDuckGo'ing I think I've encrypted the file with a blank password. It just seems odd because my command didn't include -c, i.e I wasn't telling it to encrypt the file. And why it allowed a blank password. This is user error no doubt, it just seems odd & it could have been frustrating if I'd not had a backup of the file!

Basically I think my question is; Where did I go wrong? Should I _NEVER_ use the gpg command without a parameter, i.e. I should have used -d?

Thanks!
 
Old 11-15-2018, 01:20 PM   #2
Mr Marmmalade
Member
 
Registered: Oct 2002
Location: Scotland
Distribution: Slackware + Debian
Posts: 203

Original Poster
Rep: Reputation: 26
Ah, there's possibly some sort of timeout going on maybe. I was able to later get it to prompt for pwd again somehow.
 
Old 11-15-2018, 01:32 PM   #3
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 19 MATE
Posts: 6,403
Blog Entries: 2

Rep: Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059
Quote:
Originally Posted by Mr Marmmalade View Post
Ah, there's possibly some sort of timeout going on maybe. I was able to later get it to prompt for pwd again somehow.
There is indeed. GnuPG uses gpg-agent, which caches the passphrase for a given time.

To prevent this behaviour, create ~/.gnupg/gpg-agent.conf, populate it with

Code:
default-cache-ttl 1
max-cache-ttl 1
then restart gpg-agent with:

Code:
echo RELOADAGENT | gpg-connect-agent
 
2 members found this post helpful.
Old 11-15-2018, 02:02 PM   #4
Mr Marmmalade
Member
 
Registered: Oct 2002
Location: Scotland
Distribution: Slackware + Debian
Posts: 203

Original Poster
Rep: Reputation: 26
Ah great, thanks for that hydrurga! That looks like it is disabling the cache, I shall look into that! Thanks again.
 
Old 11-15-2018, 02:30 PM   #5
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 19 MATE
Posts: 6,403
Blog Entries: 2

Rep: Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059
Quote:
Originally Posted by Mr Marmmalade View Post
Ah great, thanks for that hydrurga! That looks like it is disabling the cache, I shall look into that! Thanks again.
No problem. The only reason I knew this is that I was faced by the exact same issue 2 weeks ago due to hitting the enter key early by mistake. Must be a Scottish thing...
 
Old 11-15-2018, 03:24 PM   #6
Mr Marmmalade
Member
 
Registered: Oct 2002
Location: Scotland
Distribution: Slackware + Debian
Posts: 203

Original Poster
Rep: Reputation: 26
Aye, it wisnae me that hit the enter key, 'twas mah haggis!

:P
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] gpg: WARNING: unsafe permissions on configuration file `/home/b/.gnupg/options' gpg: widda Mandriva 9 07-30-2018 08:49 AM
gpg / gpg-agent -- Can't connect to /root/.gnupg/S.gpg-agent jrtayloriv Linux - Security 8 05-11-2017 10:34 AM
GPG issues - gpg: signing failed: Permission denied ilesterg Linux - Software 3 02-07-2017 09:19 AM
[SOLVED] Questions on GPG keyrings for debain apt-get? (fixing problem with gpg) frog-o Debian 2 05-12-2013 11:50 AM
GPG: Bad session key gpg between gpg on linux and gpg gui on windows XP konqi Linux - Software 1 07-21-2009 10:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 02:26 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration