Script .ksh to decrypt .gpg(passphrase)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script .ksh to decrypt .gpg(passphrase)
# 1  
Old 03-24-2011
Power Script .ksh to decrypt .gpg(passphrase)

Hi all,

i have to make a script in shell unix that decrypt a file .gpg ang through out in the same directory the decypted file.

Well, the problem is to put in the shell the passphrase.
Here the specifications:
File .gpg: bella.zip.gpg
File output: bella_decr.zip
passphrase: bella_zio

if someone could write me the right code to decrypt that file is terrific.

Thank you.
# 2  
Old 03-25-2011
if i write simply in the shell:

gpg --passphrase bellazio -d bella.txt.zip.gpg

the shell returns me this error:

gpg: WARNING: using insecure memory!
gpg: please see [site] for more information
Reading passphrase from file descriptor 0 ...

please help!
# 3  
Old 03-25-2011
One way:
Code:
echo "bellazio" | gpg --passphrase-fd 0 --output out.txt -d bella.txt.zip.gpg

This User Gave Thanks to fpmurphy For This Post:
# 4  
Old 03-28-2011
IT WORKS!!!!!

thanks a lot you saved my life

very last question: if i wanto to put the pass into a txt file i write "type pass.txt" istead of "echo ..." but which is the right --passphrase-fd "number"?
# 5  
Old 03-28-2011
One way:
Code:
cat passphrase.txt | gpg --passphrase-fd 0 --output out.txt -d bella.txt.zip.gpg

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Supply passphrase for ssh in script

I would like to write a bash shell script which will connect to remote server using passphrase. (I have public-private infrastructure created, and as per instruction, I must not use password less ssh). This particular script will be fired from cron. Can you please advice how I can supply the... (2 Replies)
Discussion started by: atanubanerji
2 Replies

2. Shell Programming and Scripting

Encrypt and decrypt the password in a Shell Script

Hello, I have the following UNIX shell script which connects to the teradata database and executes the SQL Queries. For this, I am passing database name, username and password. I don't want to reveal my password to anyone. So, is there any way that I can encrypt my password and read the... (2 Replies)
Discussion started by: ronitreddy
2 Replies

3. Shell Programming and Scripting

Encrypt and decrypt a password in shell script

Hi All, very good morning all. I am trying to connect to informatica repository by using shell script. I have written pmrep connect command in the script file. But i need to provide repository, domain ,username and password to connect. Username and password are hard coded in the script... (8 Replies)
Discussion started by: SekhaReddy
8 Replies

4. Shell Programming and Scripting

Bash Script to decrypt encrypt log and archive

Hi Please see if you have come across any aprts of this. I can read, integrate and syntehsixe. Any help you could offer me would be super. thanks in advance! Good day. Thank you for your response in this matter. Here are some further details: 1) scripting is to be in BASH... (1 Reply)
Discussion started by: cdc01
1 Replies

5. Shell Programming and Scripting

Need to decrypt a file in a directory (SHL script)

I need to decrypt a file in a directory, I need to write a shl scrip & cron job How I find the files in the directory: the file is like this: dailypayments_sfs_payment_201011151800.dat -d The decrypt command: gpg -o dailypayments_sfs_payment_201011151800.dat -d 20101115 (the date... (7 Replies)
Discussion started by: rechever
7 Replies

6. Shell Programming and Scripting

shell script encrypt a file using gpg

Hi, I have a requirement to encrypt a file using gpg with a public key. However when i encrypt a file, i get a question like 'Do you want to go ahead with unverified user?' . when i press 'y' file is encrypted. I am not able to automate this job because of this interactive mode. Could... (3 Replies)
Discussion started by: Deepakbabu
3 Replies

7. UNIX for Advanced & Expert Users

Decrypt a GPG file through shell script

Hi, I'm trying to decrypt a gpg file thorugh a shell script. But i' could'nt. My script is , -sh-3.1$ cat test_gpg.sh #!/bin/ksh echo " Hello, iam testing GPG" gpg prabhu.txt.gpg <<EOF prompt prabhu EOF exit 0 The file i'm trying to decrypt is prabhu.txt.gpg and my passphrase is... (1 Reply)
Discussion started by: apsprabhu
1 Replies

8. UNIX for Dummies Questions & Answers

how to give PASSPHRASE to gpg in command line?

Hello sir, I am using "gpg" command to encrypt a file. We generally do it :- then it asks us for :- I want to know how to give this Passphrase in the command line itself !!!I did read the man page but couldnt make out what is the option for it.Can u please help me out !!! (2 Replies)
Discussion started by: nsharath
2 Replies

9. UNIX for Dummies Questions & Answers

follow-up question on passphrase and script

can i use key with passphrase on a script/batch process? i am not sure how to pass the pasphrase in the script. i'd like to automate secure file transfer. thanks in advance (0 Replies)
Discussion started by: NoelSacay
0 Replies

10. Shell Programming and Scripting

Encrypt and Decrypt script

Dear Experts, I am using one script name :volume.sh and its written in bash shell script. I just want to encrypt the script so that any one else cannot see it. please tell me the commands how to encrypt the script as well as to decrypt it. Regards, SHARY (9 Replies)
Discussion started by: shary
9 Replies
Login or Register to Ask a Question