really new to linux scripting so i figured i would ask rather than waste time pulling my hair out.
i have a simple script that backs up the contents of a folder on my linux box and moves it to S3 storage, i would like this script to create a zip file and password protect it without any intervention from me.
i got it down to
zip myarchive.zip /var/www/* -e
but cannot work out where i should put the password to stop it prompting me.
thanks
kris
Doing that is a security risk as it means your password will be written in cleartext in your script.
For this reason,
ziprefuses to work that way. It wants the input from the keyboard, not your script or a file.I’m not aware of a workaround.On the other hand, at least the
zipin my Ubuntu distribution offers a-P passwordoption which, I think, allows you to enter the password right on the command line. The documentation surrounds this option with the appropriate warnings.