Solved

How to write a script for PGP encryption in unix

Posted on 2013-06-26
1
591 Views
Last Modified: 2013-06-27
Hi All,
 Can someone help me to write a script in unix which has to pick a file from a directory,encrypt the file using PGP commands and place it in the destination directory?

I am new to scripting to unix and PGP

Appreciate your help,

Thanks and Regards,
0
Comment
Question by:ra100020
1 Comment
 
LVL 24

Accepted Solution

by:
fridom earned 500 total points
Comment Utility
Well it depends on what Shell you like to use. How do you want to add the directories?

int the end you need something like

#!/usr/bin/zsh

source_directory="/usr/local/tmp"
target_directory="/tmp"
source_file="$1"

gpg --output "$target_directory/$source_file.gpg" --encrypt -r recipient $source_file  

Open in new window


It's up to you to improve on the user interface. Printing help etc. But this should give you an idea.

Regards
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now