LinuxQuestions.org
Visit Jeremy's Blog.
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, 12:18 PM   #1
Mr Marmmalade
Member
 
Registered: Oct 2002
Location: Scotland
Distribution: Debian
Posts: 214

Rep: Reputation: 27
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, 12:20 PM   #2
Mr Marmmalade
Member
 
Registered: Oct 2002
Location: Scotland
Distribution: Debian
Posts: 214

Original Poster
Rep: Reputation: 27
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, 12:32 PM   #3
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
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, 01:02 PM   #4
Mr Marmmalade
Member
 
Registered: Oct 2002
Location: Scotland
Distribution: Debian
Posts: 214

Original Poster
Rep: Reputation: 27
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, 01:30 PM   #5
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
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, 02:24 PM   #6
Mr Marmmalade
Member
 
Registered: Oct 2002
Location: Scotland
Distribution: Debian
Posts: 214

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

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

All times are GMT -5. The time now is 08:39 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
Open Source Consulting | Domain Registration