Sponsored Content
Top Forums Shell Programming and Scripting How to pass an argument to encrypted script having openssl ? Post 302961252 by akore83 on Wednesday 25th of November 2015 06:30:37 PM
Old 11-25-2015
How to pass an argument to encrypted script having openssl ?

Hi,
can it be possible to pass and argument to an encrypted script?

for example.. Say I have this script which takes one input..

Code:
> cat aa
#!/bin/ksh

UNAME=$1
echo "Hi $UNAME.."

> aa TEST
Hi TEST..

Now I encrypted this code..

Code:
> openssl enc -e -aes-256-cbc -a -in aa > bb
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:

Then I created one more script to call this encrypted script..

Code:
> cat cc
#!/bin/sh
openssl enc -d -aes-256-cbc -a -in bb -pass pass:test123 | sh -

When I ran this like normal script its showing me this error..

Code:
> cc TETS
cc: TETS: No such file or directory
cc: no input files

When I ran it without any argument/parameter..

Code:
> openssl enc -d -aes-256-cbc -a -in bb -pass pass:unix11 | sh -
Hi ..

How can I pass the argument to such encrypted script..
Thanks..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

pass argument to a filename

How can I use the value of an argument as a filename? Example: The argument for a process is 999. I would like the output of the process to be placed in a file called 999. I have tried using $$1, but that only assigns a unigue number. thanks JP (1 Reply)
Discussion started by: jpprial
1 Replies

2. UNIX for Dummies Questions & Answers

Pass argument to function

Hi, Can someone please explain to me how I can get a function to recognize a file given as an argument to a script. Suppose the script has the argument as follows: sh script file and the function is as follows: function display_file () { cat $1 } and it s then called #main program... (1 Reply)
Discussion started by: Knotty
1 Replies

3. Shell Programming and Scripting

how to pass argument remotely

If I run the following command remotely after ssh than it works fine su - oracle -c "/oracle/product/102/db/bin/dbshut" But If I run the following command it doesn't work su - oracle -c "/oracle/product/102/db/bin/lsnrctl stop" Because I think there is a space is present between lsnrctl and... (1 Reply)
Discussion started by: madhusmita
1 Replies

4. Shell Programming and Scripting

Need to pass argument

Hi, I need to pass the argument in my shell script as db_ubackup20111015*.log Scenario: I have backup log file location in /home/backup directory (more than 40 days). I need to check the log file of the latest one (tail . a. How I can retrieve the latest value other than passing... (1 Reply)
Discussion started by: prashanth_gs
1 Replies

5. Shell Programming and Scripting

How we can pass the argument when calling shell script from perl script

Can someone let me know how could I achieve this In one of per script I am calling the shell script but I need to so one thing that is one shell script call I need to pass pne argument.In below code I am calling my ftp script but here I want to pass one argument so how could I do this (e.g:... (5 Replies)
Discussion started by: anuragpgtgerman
5 Replies

6. Solaris

How edit a file encrypted with openssl ?

i have file encrypted with openssl and i can decrypt and view its content by below code openssl enc -d -blowfish -pass file:secret_key -in input_file now i need to edit the input_file . i have to remove three lines from this file . how can this be done ? (3 Replies)
Discussion started by: chidori
3 Replies

7. Shell Programming and Scripting

How to pass command line argument in shell script?

I need to write a shell script, when I run that script I should pass those arguments if not, then script should not run and pass the error message like invalid option - - should pass the argument. and Exit from the script https://www.unix.com/images/misc/progress.gif (1 Reply)
Discussion started by: Nsharma3006
1 Replies

8. UNIX for Dummies Questions & Answers

How to pass command line argument in shell script?

I need to write a shell script, when I run that script I should pass those arguments if not, then script should not run and pass the error message like invalid option - - should pass the argument. and Exit from the script (8 Replies)
Discussion started by: Nsharma3006
8 Replies

9. Shell Programming and Scripting

Pass argument in script to run specific part in that

Hello Friends, I need you help ! I have a scripts names runsteps.sh which contains command to run bunch of commands for each application you want to install " Oracle " Jboss" etc echo " Which app you want to install Jboss" ? Yes or no? read ans depending on Yes or not it goes inside... (3 Replies)
Discussion started by: saurabh84g
3 Replies

10. Shell Programming and Scripting

How to pass Oracle sql script as argument to UNIX shell script?

Hi all, $ echo $SHELL /bin/bash Requirement - How to pass oracle sql script as argument to unix shell script? $ ./output.sh users.sql Below are the shell scripts and the oracle sql file in the same folder. Shell Script $ cat output.sh #!/bin/bash .... (7 Replies)
Discussion started by: a1_win
7 Replies
pmt-ehd(8)							     pam_mount								pmt-ehd(8)

Name
       pmt-ehd - create an encrypted disk image

Syntax
       pmt-ehd [-DFx] [-c fscipher] [-h hash] [-k fscipher_keybits] [-t fstype] -f container_path -s size_in_mb

Options
       Mandatory options that are absent are inquired interactively, and pmt-ehd will exit if stdin is not a terminal.

       -D     Turn on debugging strings.

       -F     Force operation that would otherwise ask for interactive confirmation. Multiple -F can be specified to apply more force.

       -c cipher
	      The  cipher  to  be  used for the filesystem. This can take any value that cryptsetup(8) recognizes, usually in the form of "cipher-
	      mode[-extras]".  Recommended are aes-cbc-essiv:sha256 (this is the default) or aes-xts-essiv:sha256.

       -f path
	      Store the new disk image at path. If the file already exists, pmt-ehd will prompt before overwriting unless -F  is  given.  If  path
	      refers to a symlink, pmt-ehd will act even more cautious.

       -h hash
	      Message digest/hash used for key derivation in the PBKDF2 stage. The default is sha512.

       -i cipher
	      (This option had been removed in pam_mount/pmt_ehd 2.11.)

       -k keybits
	      The keysize for the cipher specified with -c. Some ciphers support multiple keysizes, AES for example is available with at least the
	      keysizes 192 and 256.  Defaults to 256 (to match aes-cbc-essiv). Note that XTS uses two keys, but drawn from the same key  material,
	      so aes-cbc-256 is equivalent to aes-xts-512, and aes-cbc-128 is to aes-xts-256.

       -p path
	      (This option had been removed in pam_mount/pmt_ehd 2.11.)

       -s size
	      The initial size of the encrypted filesystem, in megabytes. This option is ignored when the filesystem is created on a block device.

       -t fstype
	      Filesystem to use for the encrypted filesystem. Defaults to xfs.

       -u user
	      Give  the  container and fskey files to user (because the program is usually runs as root, and the files would otherwise retain root
	      ownership).

       -x     Do not initialize the container with random bytes. This may impact secrecy.

   Description
       pmt-ehd can be used to create a new encrypted container, and replaces the previous mkehd script as well as any HOWTOs that explain  how	to
       do it manually.	Without any arguments, pmt-ehd will interactively ask for all missing parameters. To create a container with a size of 256
       MB, use:

       pmt-ehd -f /home/user.cont -s 256

pam_mount							    2011-Aug-05 							pmt-ehd(8)
All times are GMT -4. The time now is 02:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy