Solved

How to write a script for PGP encryption in unix

Posted on 2013-06-26
1
713 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
ID: 39280926
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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

740 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