How to avoid password prompt in shell script for zip password protection

Hi
I am trying to set password protection to my oracle database export backup. Once the backup completed, it should compress with a password protection. Thats the plan. Initialy we were using the gzip for the compression. Then realized that there is no password protection for the gzip. Started using zip option. I tried using
zip -P <password> filename
But it was throwing below error.
-bash-3.2$ zip -P expreports REPORTS_2013FEB14.dmp
zip warning: missing end signature--probably not a zip file (did you
zip warning: remember to use binary mode when you transferred it?)
zip warning: (if you are trying to read a damaged archive try -F)
zip error: Zip file structure invalid (REPORTS_2013FEB14.dmp)
Not quite sure why.
Then I used zip -e REPORTS_2013FEB14.dmp.zip REPORTS_2013FEB14.dmp
But this prompting for the password. As I am trying to put the command in the script. It will be tough if it prompts for the password.
I would like to know how to avoid the password prompting by saving somewhere or how the code should be written. Tried using expect feature of shell script. Below was the code I tried. It didnt work.
[oracle@SF40V6636 test]$ cat repexp.sh
zip -e REPORTS_imp.log.zip REPORTS_imp.log
expect "Enter password:"
send "imprep"
expect "Verify password:"
send "imprep"
So please help in avoiding this password prompt or let me know how to change the code.
Thanks
SHIYAS M

How about using gpg and adding a secret key to the requirement of a password? No one should be able to decrypt your file, not by knowing only the password.
1. Generate a public and private key pair:
$ gpg --gen-key
When it shows "We need to generate a lot of random bytes…" open another terminal session and type "dd if=/dev/sda of=/dev/null" to create traffic. When the public and secret key created and signed you can Ctrl-C the dd command.
To see what you have created:
$ gpg --list-keys
2. Encrypt and gzip your stuff:
$ tar zcf stuff.tgz file_or_folder
$ gpg recipient "Some Name" encrypt stuff.tgz
$ rm -f stuff.tgz
3. Decrypt and extract the archive:
$ gpg batch yes --passphrase "password" -d stuff.tgz.gpg > stuff.tgz
$ tar zxvf stuff.tgz
Again, knowing the password alone will not let anybody decrypt your stuff.

Similar Messages

  • How to embed applescript into a shell script for notification center

    I have managed to cobble this together:
    You can run it in your Terminal, it is harmless, and will output results that will show you a notification from notification center:
    I have items on my pasteboard as the results of a script, I want to pbpaste them into the below command, but can't get the syntax right.  I am not objectionable to string concatenation and building or whatever it takes.
    osascript -e 'display notification "The url(s) are on your clipboard from my.app" with title "my.app has finished" subtitle "Some Sub title"'
    Ideally, I want to put `pbpaste` in the "Some title" section, but I get the literal string. I try creating a variable, and get that literal string.
    I tried building the entire string up as one variable, which in the Terminal echo'd out and works, but in Notification Center, I get the actually literal variable.  It's mainly a bash script, so the context witch to AppleScript i being a pain in the rear.
    Suggestions? Any master out there that this makes any sense to?

    As it stands, and the way you have your notification structured, this is the output from the notification center. I did an echo "From the clipboard" | pbcopy before I ran the following script. It uses a Bash function, osascript HERE document, and shows how to pass variables to the function, and receive them in AppleScript. If you want substring text that is not the result of pbpaste, then you can either make the string inside the AppleScript, or pass the string in as a variable.
    To get this output, I used the following Bash/Osascript combination:
    #!/bin/bash
    #osascript -e 'display notification "The url(s) are on your clipboard from
    #my.app" with title "my.app has finished" subtitle "Some Sub title"'
    function notification () {
      `osascript <<-AppleScript
            set txt1 to "The URL(s) are on your clipboard from "
            set txt2 to " has finished"
        set appName to "$1" as text
        set subStr to "$2" as text
        set noteStr to txt1 & appName
        set titleStr to appName & txt2
        tell application "System Events"
            display notification noteStr with title titleStr subtitle subStr
            delay 1 -- give notification time to fire
        end tell
        return quit
    AppleScript`
    appName="foo.app"
    #echo $appName
    subTitle="$(pbpaste)"
    #echo $subTitle
    notification "${appName}" "${subTitle}"
    exit 0

  • Shell script adapter and passwords

    Does anyone know how to get a password into a shell script resource adapter?
    I've set up the "password" attribute in my resource adapter's schema, expecting at least to see the encrypted password in in $WSUSER_password, but it's always empty. Other attributes I add to the resource scheme show up in the scripts as shell variables just fine.
    Side question - the Solaris resource adapter, which looks a lot like the shell script adapter, doesn't even have a password in its schema map, yet it seems to set passwords just fine. What's up with that?
    The ShellScriptResourceObjects55.xml example doesn't seem to deal with passwords at all.

    Hi,
    Have you been able to resolve this issue?
    I am currently working on configuring a Shell Script Resource on my IDM system.
    I am still in the "*Create User"* stage of things (I haven't even begun working with the other Actions : Get User, Get All Users, Delete User, Update User)
    After a month-long period of trial-and-error, and a lot of headaches, I finally succeeded in Creating a new user on my Unix Machine, without any errors
    Except for one thing : for some reason, the user I create is not being given a password!
    A first, I configured the "Attribute Mapping" page to include a "Password" attribute. This did not work.
    Then I removed the password from there (I figured that when I input the user's basic information on the IDENTITY tab in IDM, then the password gets automatically passed to the Unix machine).
    Still, this did not work.
    The funniest thing is : I am not getting any errors. The user is created on my Unix machine. And, also, in my My-SQL database.
    The problem is : when I try to log into that same Unix machine as the user, it does not work, because......of course.....*.there is NO PASSWORD*.
    What could be the problem?

  • Shell script that required password

    Hi,
    I'm using an automator script to upload some files to a remote Linux server, and I'm using rsync in an automator shell script action.
    That command required a password to work, how can I enter the password in the shell script action?
    Thanks

    Thanks for your answer, but as I'm no expert in AS,
    I'm not sure to understand your answer.
    How do those parameters are sent to AS?
    You put it in the statement:
    do shell script "rsync /source /dest" password "xyzzy" user name "you"
    You can set up a keychain for the password and retrieve it when needed, to be secure in your code. Post back or head over to AS forum, we'll help you out. http://discussions.apple.com/forum.jspa?forumID=724
    I suppose it can be run within Automator using a run
    AS instead of a run shell script. As my automator do
    some other task too.
    Yes, Automator has Run AppleScript action.
    And yes, you're right, iWeb publishing that is! Good
    guest!
    I saw some of your posts in iWeb board.
    I'm mucking around with iWeb, it's a bloated monster. There are quite a few restrictions in iWeb, I had to hand code some of the stuffs, such as meta data keywords, tricky stuffs... I'm thinking of writing a script for post production.

  • How to avoid the prompt when verifing signature?

    I sign the doc with my cert.
    The cert is not trusted by Acrobat/Reader itself so when i try to verify the signature Acrobat/Reader will prompt the user cert is not trusted.
    My question is how to avoid this prompt through Acrobat SDK or how to add my cert to trusted cert list through Acrobat SDK?
    Thanks.

    Patrick Leckey wrote:
     You will also see the BER Decoding error when you have a self-signed peer-to-peer cert in your Windows Cert Store, even if it is not the signature you are using to sign.
    Start > Run > certmgr.msc
    Look for any certs that have "peer-to-peer" in the Intended Purpose column
    Remove that cert
    Restart Acrobat
    Give that a shot.
    Patrick,I have not found the Intended purpose of cert names "peer-to-peer".
    But I have just found the cert which will cause the signature failure.
    The key is the cert can not be removed.
    I'm very curious that why a cert has no relationship with the signature could cause the signature failure?
    Is it a BUG of Acrobat/Adobe Reader?
    If not how can i operate successfully?
    Thanks.

  • How to execute sql-queries through shell scripting in linux?

    How to execute sql-queries through shell scripting in linux?

    http://www.oracle.com/technology/pub/articles/saternos_scripting.html
    Two simple examples:
    #!/usr/bin/env bash
    set_orafra () {
       orafra=`echo 'set heading off
       select name from v$recovery_file_dest;
       exit' | sqlplus -s / as sysdba`
    set_orafra
    echo $orafra
    #!/usr/bin/env bash
    export ORACLE_SID=instance_name
    export ORACLE_HOME=/path_to_oracle_home_directory
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib
    export PATH=/$ORACLE_HOME/bin/$PATH
    $ORACLE_HOME/bin/sqlplus -s <<EOF
    connect scott/tiger@my_instance_name
    INSERT INTO table VALUES (sysdate);
    exit
    EOFEdited by: Markus Waldorf on Sep 17, 2010 12:19 AM

  • Help on preparing shell script for setting the listener password

    Hi All,
    I am working on checking all my DB servers listeners and if the password is not set for the listener then I need to set the password for that.
    As we have many servers, I am planning to prepare the shell script for doing this task.
    I am familiar with setting up the listener password manually, but strucked up to prepare the shell script to do the same task.
    Can any one kindly help me on this.
    Thanks in advance,
    Mahi

    815537 wrote:
    Could any body please help me.
    Thanks,
    MahiPatience, Grasshopper
    This forum is not a chat line, and it is not paid support.
    No one is responsible for monitoring it and giving a quick response.
    Furthermore, it is a global forum. The person with the information you seek may very well live 20 time zones away from you and was going to bed just as you posted. He will not even see your post for several more hours.
    Your original post went up in the middle of the night for half the world.
    No one with the information you seek is deliberately withholding it until you sound sufficiently desperate.

  • Help needed in shell script for FTPS

    Hi,
    Im trying to build a script to download files from a secure FTP site.
    When I run the command ftps <host_address> in the unix prompt, it asks username and password, and then prompts the following question.
    Do you want to trust this certificate? y(y):
    From the prompt, I am able to type 'y' and then it is connecting to the FTP site without any issue.
    When i run the shell script which contains the same command ftps <host_address>, it prompts the same question. And then it comes out of the program saying 'Connection aborted'.
    Could anyone tell me how to avoid this prompt?
    Thanks,
    Vidhya

    Ya. It worked for me when i typed the command ftps <host_address> in the command prompt.
    When I type this command, it is asking for username,pwd and after that, it is asking 'Do you want to trust this certificate?'. For this i have typed 'y' (Yes) in the command prompt.
    After i entered 'y', the connection got established properly.
    I have included this command in a shell script, and ran this script.
    When i execute the script, i asks 'Do you want to trust this certificate?'.
    Since i will not be able to type 'y'(Yes) connection is getting aborted.
    So, I want to know how to avoid this question ot how to enter 'y' while executing the script.
    Thanks

  • Shell script for RMAN backup

    Hi,
    on 10G R2 in AIX 6.1
    I'm looking for Shell script for RMAN backup.
    Moreover , if we should connect like this :
    rman nocatalog target sys/password@myDB << EOF
    backup as compressed backupset format '$savdir/ctl_%d_%T_%s_%p' current controlfile;
    exit
    EOFHow to avoid writting password in shell script ?
    Thank you.

    user522961 wrote:
    Can you please tell me in case of having a catalog , how to connect to catalog without writting password in script ? I mean , how to write the following in a way without password :
    #!/usr/bin/ksh
    export ORACLE_SID=myDB
    ORACLE_ENV_ASK=NO
    . /usr/local/bin/oraenv
    export savedir=/backups/myDB
    rman target /  << EOF
    connect catalog rman/password@myrepository
    backup as compressed backupset
        format '$savdir/ctl_%d_%T_%s_%p'
        include current controlfile;
    exit
    EOF:p

  • Shell script for DB

    Hi,
    I have written shell script for below scenarios, can you please guide me to write this as correct way, requirment is,
    1. i need to connect the database which is on unix server , but before connecting the DB some of the files needs to be removed from \tmp directory.
    2. once removed the script need to connect the database and call the sql file which is in \tmp directory.
    3. the output files will be stored in \tmp directory start with DB name.
    4. finally csv files needs to be transferred to local windows with help of FTP. please find below the script
    #!/bin/sh
    rm -f /tmp/dbmon/DB1*
    CONNSTRING=username/PASSWORD@service
    sqlplus -s $CONNSTRING @/tmp/STATS.sql << EOF
    EXIT;
    EOF
    HOST='xxxxx'
    USER='xxxxx'
    PASSWD='xxxxxx'
    FILE='E:\STATS\DB1.*'
    cd /tmp/dbmon
    ftp -n -v $HOST << EOT
    user $USER $PASSWD
    prompt
    mput $FILE
    bye
    EOT
    EXIT;
    EOF
    Thanks
    Edited by: ASP on Nov 18, 2011 4:45 PM

    Hi ASP
    It's always a good idea to write entries to timestamped log file without which you will never know where the script went wrong or failed.
    This is not tested but just a small example
    #!/bin/sh
    export LOG_DIR=/tmp/log
    export LOGFILE=$LOG_DIR/`basename $0`_${TIMESTAMP}.log
    if [ ! -d $LOG_DIR ]
    then
         mkdir $LOG_DIR
    fi
    echo "Removing the temporary files from /tmp/dbmon at `date +%Y%m%d_%H:%M:%S`" | tee -a $LOG_FILE
    rm -f /tmp/dbmon/DB1*
    CONNSTRING=username/PASSWORD@service
    echo "Run SQLPlus file" | tee -a $LOG_FILE
    sqlplus -s $CONNSTRING @/tmp/STATS.sql << EOF
    EXIT;
    EOF
    echo "Now FTP the files to windows box " | tee -a $LOG_FILE
    HOST='xxxxx'
    USER='xxxxx'
    PASSWD='xxxxxx'
    cd /tmp/dbmon
    ftp -vn $HOST <<EOF
    quote USER $USER
    quote PASS $PASSWD
    ascii
    cd E:\STATS
    mput DB1.*
    bye
    EOF

  • Shell script for below pl/sql script dbms_file_transfer

    Please let me know how tt write the shell script for below pl/sql script dbms_file_transfer it is
    I have trasfer the files from asm into filesystem .
    it is working . but i have to put in the loop
    begin
    dbms_file_transfer.copy_file(
    source_directory_object => 'src',
    source_file_name => 'ncsn',
    destination_directory_object => 'dest',
    destination_file_name => 'ncsn');
    end;
    Edited by: user8680248 on 27/10/2009 20:55

    user8680248 wrote:
    Please let me know how tt write the shell script for below pl/sql script dbms_file_transfer it is
    I have trasfer the files from asm into filesystem .
    it is working . but i have to put in the loop
    begin
    dbms_file_transfer.copy_file(
    source_directory_object => 'src',
    source_file_name => 'ncsn',
    destination_directory_object => 'dest',
    destination_file_name => 'ncsn');
    end;What database version?
    What are you trying to do exactly?
    It's working but you have to put it in a loop. Fine, what's the problem you are having?
    begin
      loop
        exit when ... whatever the exit condition is ...
        dbms_file_transfer.copy_file(
          source_directory_object => 'src',
          source_file_name => 'ncsn',
          destination_directory_object => 'dest',
          destination_file_name => 'ncsn');
      end loop;
    end;

  • Shell script for export backup in oracle 11g

    Hi,
    Oracle version 11.2.0..
    O/S-AIX
    How to write shell script for export full backup in oracle 11g and also need to remove 2 days of old backup.
    Regards,
    Raju

    How to write shell script for export full backup in oracle 11g
    Do you mean that export is your backup strategy ? is your database running in noarchivelog mode ? if so, then why ? if not so, then why not RMAN ?
    need to remove 2 days of old backup.
    If that mean remove files older than 2 days, you can use something like this :
    $ find <absolute directory path> -mtime +2 -exec rm {} \;

  • Shell script for DB backup

    HI,
    i have written some java code Database backup but there are some problems with that so now i need to write shell script for db backup.
    what i was doing in java code i was running command like that
    /usr/local/bin/tar cvzf /export/home/monitor/FILE_20091005.tar.gz FILES/*20091005.*which compress the all *20091005* files (myisam table files)
    but after compression file doesn't extract
    so i have to write shell script for that ..... can any body guide me how can i write that kind of script and put it in cron job.
    thanks

    soundar wrote:
    Hi all,
    I have migrated database from 8i to 10gr2.For Backup in 8i, we used a RMAN shell script (scheduled uding cron tab) to backup the database to Tape.(VERITAS BACKUP).
    I am new to 10G.I checked out the options to backup the database using Oracle Enterprise manager DB console.
    http://www.oracle.com/technology/obe/10gr2_db_single/ha/rman/rman_otn.htm#t1d
    I am planning to take a test backup using the steps mentioned inthe above url.Could any one suggest whcih is the best option for database backup,eiether to use Oracle Enterprise manager DB console or thru RMAN shell script for backup..?
    Edited by: soundar on Mar 9, 2010 10:53 PMDear soudar
    I woudn't suggest you to work with EM if you want to be a professional DBA. Start learning RMAN and use CLI instead of GUI
    Those who live by the GUI, die by the GUI

  • Shell scripting for sftp command

    Guy's
    you may wondering how i can ask these question in this forum,actually it's related to abap,we have create
    unix script that will upload file from remote sftp server
    and put it  into AL11 transcation (take any location from
    your point of view),but instead of using shell script
    that is having ftp the want to go for sftp,for your undersatnding following thing's i am working with
    <b>Tcode</b>:sm69,sm49
    <b>function module</b>:SXPG_COMMAND_EXECUTE
    script that need to have sftp instead of ftp
    Connecting to ftp server to get the file on the current server
    SOURCE_FILE_NAME=TSPAR_`date +%Y%m%d`.txt
    TARGET_FILE_NAME=TSPAR_`date +%Y%m%d`.txt
    cd /interf/torrance/TCW/FI
    ftp -nv << EOF
    open 10.252.8.73 
    user sanju sanju
    cd /home/sanju
    get $SOURCE_FILE_NAME
    EOF
    cp SOURCE_FILE_NAME TARGET_FILE_NAME
    rm SOURCE_FILE_NAME
    <b>note:</b>above script is working ,but we want' sftp not ftp
    don't try above script as such,because value's are
    changed for sake of security

    Try to execute same command using your OS .
    ksh + x ( is for debugging ) shell script and see where its failing .  I also did the same thing in last project  as i have written 5 different shell scripts , for backup , append file , sending file to FTP location and then create email ...
    Hope this’ll help you
    Thanks

  • Windows Shell script for Javadoc

    Hello
    How to write the Shell script for javadoc...in this case we were
    java 1.4
    please Respond me with one example...

    Depends on the OS and what you want it to do.
    Here are several Windows examples:
    http://java.sun.com/j2se/1.4/docs/tooldocs/windows/javadoc.html#examples
    -Doug Kramer
    Javadoc team

Maybe you are looking for

  • IPad Mini Retina Display Intense Flickering Issue

    Hi all, I've got an iPad Mini Retina 16 Gb iOS 7.1.2, I purchased at end of November 2013. Beginning yesterday, I had two incidents several hours apart where the display would suddenly start flickering like an old black and white TV set. First time i

  • User wise change of sensitive fields

    Hi guys, We are having trouble with fields like payment term, payment block and baseline date. All user can change them as and when they want. Is there any possiblity of restricting of the change of these fields to users. I mean here,some users shoul

  • Tomcat Quick Start?

    I would like to set up a java Servlet training & development environment on my home computer which is an MS/Windows 2003 Server edition running IIS. I only have one, MS Front Page web page up and I'm willing to scrap that because I don't have much in

  • STATUS_CHANGES_GET does not return a list of status codes that has changed

    This function module retuns all status changes that are in JEST_BUF with the field MOD NE to SPACE. The problem is when you make status code changes, the changes are in JEST_BUF yet none of the records has the field MOD NE to SPACE. So the FM always

  • Clear and refresh

    Hi friends, I seem to have some confusion between clear and refresh. Do we use clear only for workareas and refresh only for internal tables? Can you give me an example of how these clear and refresh works for an internal table with and with out head