[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 556
  • Last Modified:

gpg Encryption, in Cron Job

An ecryption challenge using cron.

Below is my script... it is NOT working...

Here is the output... from command line

------------------------
gpg: no valid addressees
gpg: /home/ssftp/.unencrypted/Audits_Feed_201110201702.txt: encryption failed: no such user id

===================
script
===================
#!/bin/bash

for f in /home/lowessftp/.unencrypted/*.txt
do
  echo "Encrypting file $f ... "
  gpg --homedir /root/.gnupg --batch --no-tty  -o $
f.enc -e $f
        mv  /home/ssftp/.unencrypted/*.enc  /home/ssftp/export
        mv $f  /home/ssftp/.unencrypted/archive
done
0
martinmiller40
Asked:
martinmiller40
  • 2
  • 2
1 Solution
 
Garry GlendownConsulting and Network/Security SpecialistCommented:
add the recipient mail address (whose public key must be in the key ring) with "--recipient mail@addre.ss"
0
 
martinmiller40Author Commented:
I got a little farther, and other ideas to this output ?
 Thx Martin
============
[root@lnn1111 .unencrypted]# sh /etc/cron.hourly/encryptfiles.sh
Encrypting file /home/ssftp/.unencrypted/Factory_Audits_Feed_201110201702.txt ...
gpg: prodedi1@domain.com: skipped: unusable public key
gpg: /home/ssftp/.unencrypted/Factory_Audits_Feed_201110201702.txt: encryption failed: unusable public key
0
 
Garry GlendownConsulting and Network/Security SpecialistCommented:
Did you sign the key or trust it? Most likely not. Either sign it using your private key, or alter the key so GPG will trust it:

$ gpg --edit the@key.adr
[..]
Command > trust
[..]
Please decide how far you trust this user to correctly
verify other users' keys (by looking at passports,
checking fingerprints from different sources...)?

 1 = Don't know
 2 = I do NOT trust
 3 = I trust marginally
 4 = I trust fully
 5 = I trust ultimately
 m = back to the main menu
Your decision? 5
Do you really want to set this key to ultimate trust? y
[..]
Command > save

Open in new window

Once done, you should be able to use it ... (signing the key also sets the trust to "5")
0
 
martinmiller40Author Commented:
Thank you!
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now